为何会WA 6个点。。。
  • 板块灌水区
  • 楼主znwyx
  • 当前回复6
  • 已保存回复6
  • 发布时间2022/10/6 15:44
  • 上次更新2023/10/27 08:30:01
查看原帖
为何会WA 6个点。。。
33444
znwyx楼主2022/10/6 15:44
#include <bits/stdc++.h>
using namespace std;

struct Passager{
	int time0;
	int country0;
};

queue <Passager> Q;
int Country[300000], ans[300000], pass[300000], n; 
int main(){
	cin >> n;
	int cnt = 0;
	int t, k;
	for (int i = 1; i <= n; i++){
		cin >> t >> k;
		while(!Q.empty() && Q.front().time0 + 86400 < t){
			Country[Q.front().country0]--;
			if (Country[Q.front().country0] == 0) cnt--;
			Q.pop();
		}
		for (int j = 1; j <= k; j++){
			cin >> pass[j];
			if (Country[pass[j]] == 0) cnt++;
			Country[pass[j]]++;
			Passager tmp;
			tmp.time0 = t;
			tmp.country0 = pass[j];
			Q.push(tmp);
		}
		ans[i] = cnt;
	}
	for (int i = 1; i <= n; i++)
		cout << ans[i] << endl;
	return 0;
}
2022/10/6 15:44
加载中...