40pts求解
查看原帖
40pts求解
1065753
__bjxx0201__楼主2024/8/9 16:45

rt:

#include <bits/stdc++.h>
#define int long long
#define u 10000001
using namespace std;
int n,k,t,l,ans;
int w[u],x[u],y[u];
void calc (int t,int k) {
	int l=0,r=0;
	for (int i=1;i<=k;i++) {
		y[++r]=t;
		cin>>x[i];
		if (!w[x[r]]) ans++;
		w[x[r]]++;
	}
	while (t-y[l]>=86400) {
		w[x[l]]--;
		if (!w[x[l]]) ans--;
		l++;
	}
	cout<<ans<<"\n";
}
signed main() {
	cin>>n;
	while (n--) {
		cin>>t>>k;
		calc (t,k);
	}
	return 0;
}
2024/8/9 16:45
加载中...