求助
查看原帖
求助
267125
宋小陀螺楼主2022/1/24 19:54
#include<bits/stdc++.h>
using namespace std;
struct node 
{
	int t,x;
	node(int _t,int _x) {t = _t;x = _x;}
};
int n,ti,ki,xi,con[100005],ans;
queue<node> q;
int main()
{
	cin >> n;
	for (int i = 1;i <= n;i++) 
	{
		cin >> ti >> ki;
		for (int j = 1;j <= ki;j++) 
		{
			cin >> xi;
			q.push(node(ti,xi));
			if (!con[xi]) ans++;
			con[xi]++;
		}
		while (!q.empty() && ti - q.front().t >= 86400) 
		{
			con[q.front().x]--;
			if (!con[q.front().x]) ans--;
			q.pop();
		}
		cout << ans << endl;
	}
	return 0;
}

这份代码在洛谷AC,在这里却超时

2022/1/24 19:54
加载中...