QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#137194 | #5521. Excellent XOR Problem | The_Hallak# | WA | 1ms | 3472kb | C++17 | 1.0kb | 2023-08-10 03:46:49 | 2023-08-10 03:46:50 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll N = 1e6 + 10, MM = 1e9 + 7, MAX = 1e18;
int solve() {
int n; cin >> n;
vector<ll>v(n+1);
map<ll, ll>mp;
for (int i = 0; i < n; i++) {
cin >> v[i + 1];
mp[v[i + 1]]++;
v[i + 1] ^= v[i];
}
if (mp.size() == 1 && (n % 2 == 0||mp.begin()->first==0))return cout << "NO\n", 0;
if (v[n] != 0) {
cout << "YES\n2\n1 1\n2 " << n << '\n';
return 0;
}
for (int i = 1; i <= n; i++) {
if(v[i])
mp[v[i]] = i;
}
if (mp.size() > 1) {
cout << "YES\n";
cout << 3 << '\n';
int i = mp.begin()->second;
int j = mp.begin()->second;
if (i > j)swap(i, j);
cout << 1 << " " << i << '\n';
cout << i + 1 << " " << j << '\n';
cout << j + 1 << n << '\n';
}
else {
cout << "NO\n";
}
return 0;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t = 1;
cin >> t;
int i = 1;
while (t--) {
//cout << "case " << i << ": ";
solve();
}
return 0;
}
/*
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3472kb
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 1 23 YES 2 1 1 2 5 NO
result:
wrong answer Integer 1 violates the range [2, 3] (test case 2)