why???????????????????????
  • 板块学术版
  • 楼主OIer_hzn
  • 当前回复6
  • 已保存回复6
  • 发布时间2022/12/29 19:06
  • 上次更新2023/10/24 06:11:53
查看原帖
why???????????????????????
747142
OIer_hzn楼主2022/12/29 19:06
//
//  main.cpp
//  海港
//
//  Created by aa on 2022/12/29.
//


#include<iostream>
#include<queue>
#include<algorithm>
using namespace std;
int con[1000000];
const int second=86400;
struct data{
   int a,nat;
};
int main(){
   std::ios::sync_with_stdio(0);
   cin.tie(0); cout.tie(0);
   queue<data> q;
   int n,temp,ans=0,k,t;
   cin>>n;
   while(n--){
       cin>>temp>>k;
       while(q.size()){
           data h=q.front();
           if(temp-h.a>=second){
               con[h.nat]--;
               if(con[h.nat]<=0){
                   ans--;
               }
               q.pop();
           }else{
               break;
           }
       }
       for(int i=1;i<=k;i++){
           cin>>t;
           data x;
           x.a=temp;
           x.nat=t;
           q.push(x);
           con[x.nat]++;
           if(con[x.nat]==1){
               ans++;
           }
       }
       cout<<ans<<endl;
   }
   return 0;
}


这个代码为什么会ce

我用Xcode

2022/12/29 19:06
加载中...