QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#61698 | #4830. Transfer of Duty | yanran | 0 | 12ms | 7552kb | C++14 | 678b | 2022-11-14 16:22:24 | 2023-02-13 21:57:17 |
Judging History
answer
#include <bits/stdc++.h>
#define IOS\
ios::sync_with_stdio(false);\
cin.tie(0), cout.tie(0);
using namespace std;
const int N = 1e6 + 3;
int a[N], n, h1, h2;
char ch[10];
signed main() {
srand(time(0));
mt19937 mt(114514);
IOS;
for (int i = 1; i < N; i++) {
a[i] = mt();
}
// cout << a[483440] << '\n';
cin >> ch;
if (ch[0] == 'r') {
cin >> h1 >> h2;
}
cin >> n;
for (int i = 1, x; i <= n; i++) {
cin >> x;
h1 ^= x;
h2 ^= a[x];
if (!h1 && !h2) {
cout << "0\n";
}
else if (a[h1] == h2) {
cout << h1 << '\n';
}
else cout << "-1\n";
}
if (ch[0] == 's') cout << h1 << " " << h2 << '\n';
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 11ms
memory: 7292kb
input:
start 5 10 14 10 12 10
output:
10 -1 14 -1 -1 8 -379904591
input:
resume 8 -379904591 6 14 277 12 10 277 12
output:
-1 -1 -1 277 0 12
result:
ok
Test #2:
score: 100
Accepted
time: 11ms
memory: 7552kb
input:
start 1 1
output:
1 1 -1341078317
input:
resume 1 -1341078317 1 1
output:
0
result:
ok
Test #3:
score: 100
Accepted
time: 8ms
memory: 7496kb
input:
start 1 1000000
output:
1000000 1000000 234262076
input:
resume 1000000 234262076 2 1 1000000
output:
-1 1
result:
ok
Test #4:
score: 100
Accepted
time: 5ms
memory: 7500kb
input:
start 2 1 1
output:
1 0 0 0
input:
resume 0 0 2 1000000 1000000
output:
1000000 0
result:
ok
Test #5:
score: 100
Accepted
time: 12ms
memory: 7336kb
input:
start 3 1 2 3
output:
1 -1 -1 0 -830220605
input:
resume 0 -830220605 2 4 5
output:
-1 -1
result:
ok
Test #6:
score: 0
Stage 1: Program answer Runtime Error
input:
start 5 483440 800458 959493 679027 187008