AcWing 467. 海港
原题链接
简单
作者:
一块两毛五
,
2024-03-30 17:02:18
,
所有人可见
,
阅读 1
#include <iostream>
#include <queue>
using namespace std;
struct P{
int t;
int x;
P(int a,int b){
t = a, x = b;
}
};
int n;
int v[100010];
int ans;
deque<P> q;
int main()
{
cin >> n;
for(int i = 0; i < n; i++)
{
int t, k;
cin >> t >> k;
for(int j = 0; j < k; j++)
{
int x;
cin >> x;
if(!v[x])
ans++;
q.push_back(P(t, x));
v[x]++;
}
while(t - q.front().t >= 86400)
{
auto h = q.front();
q.pop_front();
v[h.x]--;
if(!v[h.x])
ans--;
}
cout << ans << endl;
}
return 0;
}