QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#102648 | #5521. Excellent XOR Problem | qawszx# | WA | 0ms | 3412kb | C++20 | 947b | 2023-05-03 15:28:28 | 2023-05-03 15:28:32 |
Judging History
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)