QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#102450 | #5521. Excellent XOR Problem | Yldar# | WA | 141ms | 13344kb | C++17 | 1.3kb | 2023-05-03 13:22:41 | 2023-05-03 13:22:44 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
using namespace std;
const int inf=0x3f3f3f3f;
const ll linf=0x3f3f3f3f3f3f3f3fll;
inline long long read(){
long long s=0,w=1;
char ch=getchar();
while(ch<'0'||ch>'9') {if (ch=='-') w=-1;ch=getchar();}
while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
return s*w;
}
void doit(){
int n=read();
map<int,int>q;
vector<int>a(n+1);
int ff=0;
long long k=0;
for(int i=1;i<=n;i++) {
a[i]=read();
k=k^a[i];
if (q[a[i]]) ff=1;
q[a[i]]++;
if (q[a[i]]==n&&a[i]==0){
printf("NO\n");
return ;
}
if (q[a[i]]==n&&n%2==0) {
printf("NO\n");
return ;
}
}
printf("YES\n");
if (k!=0){
printf("2\n");
printf("1 1\n2 %d\n",n);
return;
}
k=k^a[1];
printf("3\n");
long long now=0;
for(int i=2;i<=n-1;i++){
now=now^a[i];
if (now!=a[1]&&(k^now)!=a[1]&&(k^now)!=now) {
printf("1 1\n2 %d\n%d %d\n",i,i+1,n);
return ;
}
}
}
int main(){
// freopen("input.in","r",stdin);
// freopen("output.out","w",stdout);
int T=read();
while(T--){
doit();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3600kb
input:
4 2 0 0 3 1 2 3 5 16 8 4 2 1 6 42 42 42 42 42 42
output:
NO YES 3 1 1 2 2 3 3 YES 2 1 1 2 5 NO
result:
ok Correct (4 test cases)
Test #2:
score: 0
Accepted
time: 8ms
memory: 3760kb
input:
1 200000 0 0 104990627 0 104990627 0 0 0 0 104990627 0 104990627 0 0 104990627 104990627 0 0 0 0 0 104990627 0 0 0 104990627 104990627 104990627 0 104990627 0 104990627 104990627 0 104990627 0 0 0 104990627 104990627 0 0 104990627 104990627 0 0 104990627 0 0 0 0 0 104990627 104990627 0 0 0 0 0 10499...
output:
YES 2 1 1 2 200000
result:
ok Correct (1 test case)
Test #3:
score: 0
Accepted
time: 130ms
memory: 13344kb
input:
1 200000 916550535 1039111536 183367143 845311658 473404911 844600350 249761080 860927112 268559756 661297994 448456545 184790162 804023458 655065019 442145717 130497524 509071033 644651807 1039510287 766490362 514960668 612238468 863513676 417538457 839195481 901404895 760875212 983171045 343221187...
output:
YES 3 1 1 2 2 3 200000
result:
ok Correct (1 test case)
Test #4:
score: 0
Accepted
time: 141ms
memory: 13260kb
input:
1 200000 697100980 63360185 3577101 75632048 903073319 644702701 1017474476 268785811 6091842 227390753 270800416 554896940 318364388 526066510 354510498 1034952286 613138496 176305121 384248064 715019967 999545181 91222841 1063728923 665773338 354670745 473570604 220064105 301115885 1038664738 3094...
output:
YES 2 1 1 2 200000
result:
ok Correct (1 test case)
Test #5:
score: 0
Accepted
time: 13ms
memory: 3844kb
input:
1 200000 446225258 446225258 446225258 446225258 0 0 446225258 446225258 0 446225258 0 0 446225258 0 446225258 0 446225258 446225258 446225258 0 446225258 0 0 446225258 0 0 446225258 446225258 446225258 446225258 0 0 0 446225258 0 446225258 446225258 0 0 0 0 446225258 446225258 446225258 446225258 0...
output:
YES 3 1 1 2 139152 139153 200000
result:
ok Correct (1 test case)
Test #6:
score: -100
Wrong Answer
time: 9ms
memory: 3768kb
input:
1 200000 917884074 0 917884074 917884074 0 0 0 917884074 917884074 0 917884074 0 0 0 917884074 0 917884074 917884074 0 917884074 0 917884074 0 917884074 0 917884074 0 0 917884074 0 0 0 0 917884074 0 0 917884074 0 0 917884074 0 0 0 917884074 0 0 917884074 917884074 917884074 0 917884074 917884074 917...
output:
YES 3
result:
wrong output format Unexpected end of file - int32 expected (test case 1)