QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#108716 | #5521. Excellent XOR Problem | chenshi | WA | 0ms | 1752kb | C++ | 471b | 2023-05-26 14:05:10 | 2023-05-26 14:05:14 |
Judging History
answer
#include<cstdio>
using namespace std;
const int o=2e5+10;
int T,n,a[o],v;
int main(){
for(scanf("%d",&T);T--;){
scanf("%d",&n);v=0;
for(int i=1;i<=n;++i) scanf("%d",&a[i]),v|=a[i];
if((!v)||(n==2&&a[1]==a[2])){printf("NO\n");continue;}
printf("YES\n");
if(n==2){printf("2\n1 1\n2 2\n");continue;}
v=0;
for(int i=3;i<=n;++i) v^=a[i];
if(a[1]==v&&a[2]==v) printf("2\n1 2\n3 %d\n",n);
else printf("3\n1 1\n2 2\n3 %d\n",n);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 1752kb
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 3 1 1 2 2 3 5 YES 3 1 1 2 2 3 6
result:
FAIL all xors must be different (test case 4)