QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#61692 | #4830. Transfer of Duty | yanran | 0 | 2ms | 3592kb | C++14 | 647b | 2022-11-14 16:17:56 | 2023-02-13 21:57:10 |
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 = 100 + 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();
}
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: 0ms
memory: 3592kb
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: 2ms
memory: 3416kb
input:
start 1 1
output:
1 1 -1341078317
input:
resume 1 -1341078317 1 1
output:
0
result:
ok
Test #3:
score: 0
Stage 1: Program answer Runtime Error
input:
start 1 1000000