Accepted
代码
#include <bits/stdc++.h>
using namespace std;
int seed, n;
int rnd() { return seed = (seed * 19260817ll + 20230853) & INT_MAX; }
priority_queue<int, vector<int>, greater<int> > pq;
int main() {
cin >> n >> seed;
int ans = 0;
for (int i = 1; i <= (n >> 1); ++i) pq.push(rnd());
for (int i = 1; i <= (n >> 1); ++i) {
switch (rnd() % 3) {
case 0:
pq.push(rnd());
break;
case 1:
pq.pop();
break;
default:
ans ^= pq.top();
}
}
cout << ans << endl;
return 0;
}
信息
- 递交者
- 类型
- 递交
- 题目
- P1004 Heaptester
- 语言
- C++
- 递交时间
- 2020-12-20 08:06:18
- 评测时间
- 2021-01-10 10:16:44
- 评测机
- 分数
- 100
- 总耗时
- 21219ms
- 峰值内存
- 128.426 MiB