QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#61746 | #4830. Transfer of Duty | yqyx | 0 | 1133ms | 74064kb | C++17 | 764b | 2022-11-14 18:41:55 | 2023-02-13 22:05:45 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
#define N 1000001
#define mkp make_pair
using namespace std;
ll read(){
ll x=0,fl=1; char ch=getchar();
while(ch<'0'||ch>'9'){ if(ch=='-')fl=-1; ch=getchar();}
while(ch>='0'&&ch<='9'){ x=x*10+ch-'0'; ch=getchar();}
return x*fl;
}
int n;
char ch[15];
ll a[N],jl,jr;
map<ll,int> mp;
int main(){
mt19937 mt(4266666);
for(int i=1;i<N;i++){
a[i]=mt();
mp[a[i]]=i;
}
scanf("%s",ch);
if(ch[0]=='r'){
jl=read(); jr=read();
}
n=read();
int u;
for(int i=1;i<=n;i++){
u=read();
jl^=a[u],jr^=u;
if(!jl&&!jr) printf("0\n");
else if(mp[jl]==jr&&jr<N) printf("%d\n",mp[jl]);
else printf("-1\n");
}
if(ch[0]=='s'){
printf("%lld %lld\n",jl,jr);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1035ms
memory: 73940kb
input:
start 5 10 14 10 12 10
output:
10 -1 14 -1 -1 1880360453 8
input:
resume 1880360453 8 6 14 277 12 10 277 12
output:
-1 -1 -1 277 0 12
result:
ok
Test #2:
score: 100
Accepted
time: 1074ms
memory: 74012kb
input:
start 1 1
output:
1 2485002442 1
input:
resume 2485002442 1 1 1
output:
0
result:
ok
Test #3:
score: 100
Accepted
time: 1106ms
memory: 74064kb
input:
start 1 1000000
output:
1000000 1380021055 1000000
input:
resume 1380021055 1000000 2 1 1000000
output:
-1 1
result:
ok
Test #4:
score: 100
Accepted
time: 1133ms
memory: 73844kb
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: 0
Wrong Answer on the first run
input:
start 3 1 2 3
output:
1 -1 0 1919143083 0
input:
output:
result:
wrong answer wrong answer on the first run, query 3: read 0 but expected -1