#include<iostream>
#include<cstdio>
#include<cmath>
#include<queue>
#include<cstring>
using namespace std;
struct tw{
int n,ti;
queue<int>t;
};
queue<tw>k;
int b[300001];
int main(){
int n;
cin>>n;
int ti=-1;
for(int i=1;i<=n;i++){
int tmp1,tmp2,tmp3;
cin>>tmp1>>tmp2;
if(ti==-1) ti=tmp1;
tw tmp;
tmp.ti=tmp1;tmp.n=tmp2;
for(int j=1;j<=tmp2;j++){
cin>>tmp3;
tmp.t.push(tmp3);
}
k.push(tmp);
if(tmp1-ti>=86400){
k.pop();
tw tmp4=k.front();
while(1){
tmp4=k.front();
if(tmp1-tmp4.ti>=86400)k.pop();
else{
ti=tmp4.ti;
break;
}
}
}
memset(b,0,sizeof(b));
int ans=0;
for(int o=1;o<=k.size();o++){
tw aba=k.front();
for(int j=1;j<=aba.n;j++){
if(b[aba.t.front()]==0){
b[aba.t.front()]=1;
ans++;
}
int ab=aba.t.front();
aba.t.pop();
aba.t.push(ab);
}
k.pop();
k.push(aba);
}
cout<<ans<<endl;
}
}
本人萌新,写的代码可能有点长,大佬见谅