QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#393688#5521. Excellent XOR ProblemYanagi_OrigamiWA 0ms3796kbC++14765b2024-04-19 07:52:532024-04-19 07:52:54

Judging History

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

  • [2024-04-19 07:52:54]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3796kb
  • [2024-04-19 07:52:53]
  • 提交

answer

#include <iostream>
#include <cstdio>
#include <cmath>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
const int N = 2e5+5;
int n,a[N],s[N];
void solve(){
	scanf("%d",&n);
	rep(i,1,n) scanf("%d",a+i);
	rep(i,1,n) s[i] = s[i-1]^a[i];
	if(s[n]!=0){
		rep(i,1,n) if(s[i]!=s[n]){
			puts("YES");
			printf("1 %d\n%d %d\n",i,i+1,n);
			return ;
		}
	}else{
		int m = n+1;
		per(i,n-1,1) if(s[i]!=0){
			m = i; break;
		}
		if(m == n+1){
			puts("NO");
			return ;
		}
		rep(i,1,m) if(s[i]!=s[m]&&s[i]!=0){
			puts("YES");
			printf("1 %d\n%d %d\n%d %d\n",i,i+1,m,m+1,n);
			return ;
		}
	}
	puts("NO");
}

int main(){
	int T; scanf("%d",&T);
	while(T--) solve();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3796kb

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
1 1
2 2
3 3
YES
1 1
2 5
NO

result:

wrong answer Integer 1 violates the range [2, 3] (test case 2)