QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#86922 | #4830. Transfer of Duty | Ignotus | 0 | 11ms | 11348kb | C++14 | 915b | 2023-03-11 14:50:47 | 2023-03-11 14:50:59 |
Judging History
answer
#include <bits/stdc++.h>
using ull = unsigned long long;
const int N = 1e6 + 10;
std::mt19937_64 rng(41);
std::string oper;
ull a[N], xsum, xid;
int n;
void Anya(){
std::cin >> n;
for(int i = 1, x; i <= n; ++i){
std::cin >> x;
xsum ^= a[x], xid ^= x;
if(!xsum && !xid) std::cout << "0\n";
else if(xid < N & a[xid] == xsum) std::cout << xid << '\n';
else std::cout << "-1\n";
}
std::cout << xsum << " " << xid << '\n';
}
void Andrei(){
std::cin >> xsum >> xid;
std::cin >> n;
for(int i = 1, x; i <= n; ++i){
std::cin >> x;
xsum ^= a[x], xid ^= x;
if(!xsum && !xid) std::cout << "0\n";
else if(xid < N & a[xid] == xsum) std::cout << xid << '\n';
else std::cout << "-1\n";
}
}
int main(){
std::ios::sync_with_stdio(false);
std::cin >> oper;
for(int i = 1; i < N; ++i) a[i] = rng();
if(oper == "start") Anya();
else Andrei();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 11ms
memory: 11192kb
input:
start 5 10 14 10 12 10
output:
10 -1 14 -1 -1 9111532157656318823 8
input:
resume 9111532157656318823 8 6 14 277 12 10 277 12
output:
-1 -1 -1 277 0 12
result:
ok
Test #2:
score: 100
Accepted
time: 7ms
memory: 11172kb
input:
start 1 1
output:
1 15926475875848578451 1
input:
resume 15926475875848578451 1 1 1
output:
0
result:
ok
Test #3:
score: 100
Accepted
time: 8ms
memory: 11276kb
input:
start 1 1000000
output:
1000000 2177766039474956394 1000000
input:
resume 2177766039474956394 1000000 2 1 1000000
output:
-1 1
result:
ok
Test #4:
score: 100
Accepted
time: 10ms
memory: 11192kb
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: 11ms
memory: 11348kb
input:
start 3 1 2 3
output:
1 -1 -1 7100605798830919018 0
input:
resume 7100605798830919018 0 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
output:
483440 -1 -1