题解:P2058 [NOIP2016 普及组] 海港
solution
桶加队列。开一个桶数组
code
#include<bits/stdc++.h>
using namespace std;
int n, ans, num[100005];
struct node{ int x, t; } h;
queue<node> q;
int main(){
cin >> n;
for(int i=1, t, k; i<=n; i++){
cin >> t >> k;
for(int j=1, x; j<=k; j++)
cin >> x,
q.push({x, t}),
ans+=(++num[x]==1);
for (h=q.front(); q.size()&&h.t+86400<=t; q.pop(), h=q.front())
ans-=(--num[h.x]==0);
cout << ans << '\n';
}
return 0;
}