QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#108716#5521. Excellent XOR ProblemchenshiWA 0ms1752kbC++471b2023-05-26 14:05:102023-05-26 14:05:14

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-26 14:05:14]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:1752kb
  • [2023-05-26 14:05:10]
  • 提交

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)