QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#102648#5521. Excellent XOR Problemqawszx#WA 0ms3412kbC++20947b2023-05-03 15:28:282023-05-03 15:28:32

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-03 15:28:32]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3412kb
  • [2023-05-03 15:28:28]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>
using namespace std;
const int N=200010;
int n,a[N],pre[N],suf[N];
void solve(){
	cin >> n;
	for(int i=1;i<=n;i++)cin >> a[i];
	for(int i=1;i<=n;i++)pre[i]=pre[i-1]^a[i];
	suf[n+1]=0;
	for(int i=n;i>=1;i--)suf[i]=suf[i+1]^a[i];
	for(int i=1;i<n;i++)
		if(pre[i]!=suf[i+1]){
			puts("YES");
			puts("2");
			cout << 1 << ' ' << i << '\n';
			cout << i+1 << ' ' << n << '\n';
			return ;
		}
	for(int i=1;i+2<=n;i++){
		if(a[i]){
			int s=0;
			for(int j=i+1;j+1<=n;j++){
				s^=a[j];
				if(s!=0&&s!=a[i]){
					puts("YES");
					puts("3");
					cout << 1 << ' ' << i << '\n';
					cout << i+1 << ' ' << j << '\n';
					cout << j+1 << ' ' << n << '\n';
					return ;
				}
			}
			break;
		}
	}
	puts("NO");
}
int main(){
//	freopen("data.in","r",stdin);
	ios::sync_with_stdio(0);
	int T;cin >> 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: 3412kb

input:

4
2
0 0
3
1 2 3
5
16 8 4 2 1
6
42 42 42 42 42 42

output:

1 1
2 2
3 3
1 1
2 5
NO
YES
3
YES
2
NO

result:

wrong answer Token parameter [name=yes/no] equals to "1", doesn't correspond to pattern "[yY][eE][sS]|[nN][oO]" (test case 1)