大佬们求看这个代码有什么错误...
查看原帖
大佬们求看这个代码有什么错误...
448910
_Goodnight楼主2021/9/20 17:21
#include <iostream>
#include <queue>
#include <algorithm>
#include <cstring>
#include <map>
#include <stack>
using namespace std;
int x[300010], head, tail, n,book[100010];
struct node {
	int t, k;
};
queue<node> Q;
int main() {
	//freopen("C:\\Users\\Administrator\\Downloads\\P2058_2.in","r",stdin);
	cin >> n;
	for (int i = 0; i < n; i++) {
		int ans = 0;
		node u;
		cin >> u.t >> u.k;
		Q.push(u);
		for (int j = 0; j < u.k; j++) {
			int t; 
			cin >> t; 
			x[tail++] = t;
		}
		while(Q.front().t + 86400 <= u.t) {
			int num = u.k;
			head += num;
			Q.pop();
		}
		memset(book, 0, sizeof(book));
		for (int m = head; m < tail; m++) {
			if (book[x[m]] == 0) {
				book[x[m]] = 1;
				ans++;
			}
		}
		cout << ans<<endl;
	}

}
2021/9/20 17:21
加载中...