P2058 [NOIP2016 普及组] 海港

 

>>>人是按照 时间顺序进队的

>>>people -> time + ki

>>>人的数据规模< ->桶排序

#include<bits/stdc++.h>
using namespace std;
int s,i=0,n,t,k,r,w[100001],x[300002],y[300002];
int main()
{
    cin>>n;
    while(n--){
        cin>>t>>k;
        while(k--){
            y[++r]=t;cin>>x[r];//ren -> t ki
            if(!w[x[r]])s++;//s->type
            w[x[r]]++;
        }
        while(t-y[i]>=86400)
        {
            w[x[i]]--;
            if(!w[x[i]])s--;
            i++;

        }
        cout<<s<<endl;
    }
    return 0;
}
View Code

 

 
 
 
posted @ 2023-08-10 18:28  JMXZ  阅读(7)  评论(0)    收藏  举报