社区讨论
40pts悬棺
P2058[NOIP 2016 普及组] 海港参与者 2已保存回复 2
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 2 条
- 当前快照
- 1 份
- 快照标识符
- @mhjq9rb2
- 此快照首次捕获于
- 2025/11/04 06:44 4 个月前
- 此快照最后确认于
- 2025/11/04 06:44 4 个月前
CPP
#include <queue>
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <string>
using namespace std;
int main() {
int n = 0, ans = 0, cnt[100010] = {};
cin >> n;
queue<pair<int, int>> q;
for (int i = 0; i < n; ++i) {
int t = 0, k = 0;
cin >> t >> k;
for (int j = 0; j < k; ++j) {
int x = 0;
cin >> x;
q.push({x, t});
if ((++cnt[x]) == 1) ++ans;
while (!q.empty() && q.front().second + 86400 <= t) {
q.pop();
if ((--cnt[q.front().first]) == 0) --ans;
}
}
cout << ans << endl;
}
return 0;
}
回复
共 2 条回复,欢迎继续交流。
正在加载回复...