QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#656110 | #4830. Transfer of Duty | wangjingheng | 0 | 0ms | 3624kb | C++20 | 1.3kb | 2024-10-19 11:24:46 | 2024-10-19 11:24:47 |
answer
#include<bits/stdc++.h>
// #define int long long
using namespace std;
const int N=1e6+10;
void solve(){
string s;cin>>s;
if(s=="start"){
int n;cin>>n;
int x=0,y=0;
for(int i=1;i<=n;i++){
int e;cin>>e;
x^=e;y^=(e*e);
if(x==0&&y==0){
cout<<"0\n";
}
else if(y==x*x){
cout<<x<<"\n";
}
else cout<<"-1\n";
}
cout<<x<<"|"<<y<<"\n";
}
else{
int x=0,y=0,ok=0;
string ss;cin>>ss;
for(int i=0;i<ss.length();i++){
if(ss[i]=='|'){
ok=i-1;break;
}
}
for(int i=0;i<=ok;i++){
x=x*10+(ss[i]-'0');
}
for(int i=ok+2;i<ss.length();i++){
y=y*10+(ss[i]-'0');
}
int n;cin>>n;
for(int i=1;i<=n;i++){
int e;cin>>e;
x=x^e;
y=y^(e*e);
if(x==0&&y==0){
cout<<"0\n";
}
else if(y==x*x){
cout<<x<<"\n";
}
else cout<<"-1\n";
}
}
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
// int T;cin>>T;
// while(T--)
solve();
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3572kb
input:
start 5 10 14 10 12 10
output:
10 -1 14 -1 -1 8|48
input:
resume 8|48 6 14 277 12 10 277 12
output:
-1 -1 -1 277 0 12
result:
ok
Test #2:
score: 100
Accepted
time: 0ms
memory: 3624kb
input:
start 1 1
output:
1 1|1
input:
resume 1|1 1 1
output:
0
result:
ok
Test #3:
score: 0
Wrong Answer
time: 0ms
memory: 3564kb
input:
start 1 1000000
output:
1000000 1000000|-727379968
input:
resume 1000000|-727379968 2 1 1000000
output:
-1 -1
result:
wrong answer