QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#393688 | #5521. Excellent XOR Problem | Yanagi_Origami | WA | 0ms | 3796kb | C++14 | 765b | 2024-04-19 07:52:53 | 2024-04-19 07:52:54 |
Judging History
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;
}
详细
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)