QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#656110#4830. Transfer of Dutywangjingheng0 0ms3624kbC++201.3kb2024-10-19 11:24:462024-10-19 11:24:47

Judging History

你现在查看的是最新测评结果

  • [2024-10-19 11:24:47]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:3624kb
  • [2024-10-19 11:24:46]
  • 提交

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