10pts求条
查看原帖
10pts求条
1345783
BK小鹿楼主2024/9/21 22:35
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>

#define x first
#define y second

using namespace std;

typedef pair<int, int> PII;

#define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<20,stdin),p1==p2)?EOF:*p1++)
char *p1,*p2,buf[1<<20+5];
inline int read(){
int x=0;
char c=gc();
while(!isdigit(c)){
c=gc();
}while(isdigit(c)){
x=x*10+(c^48);
c=gc();
}return x;
}

const int N = 50005;

int n;
int st[N];
queue<PII> q;

int main()
{
    n = read();
    for (int i = 1; i <= n; i ++ )
    {
        int cnt = 0;
        int t, k;
        t = read(), k = read();
        for (int j = 1; j <= k; j ++ )
        {
            int x ;
            x = read();
            q.push({t, x});
            if (!st[x]) cnt ++ , st[x] ++ ;
        }

        while (!q.empty() && (q.front().x - t >= 86400)) {st[q.front().y] --; if (!st[q.front().y]) cnt -- ; q.pop();}
        printf("%d\n", cnt);
    }
    return 0;
}
2024/9/21 22:35
加载中...