QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#137189 | #5521. Excellent XOR Problem | The_Hallak# | WA | 1ms | 3516kb | C++17 | 943b | 2023-08-10 03:34:37 | 2023-08-10 03:35:14 |
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 + 2 <= n; i++) {
if (v[i] != v[n]) {
cout << "YES\n";
cout << 3 << '\n';
cout << 1 << " " << i << '\n';
cout << i + 1<<" " << i + 2 << '\n';
cout << i + 2 << " " << n << '\n';
return 0;
}
}
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: 3516kb
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 3 3 3 YES 2 1 1 2 5 NO
result:
FAIL has to be a partition (test case 2)