QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#554108 | #5521. Excellent XOR Problem | Richw818 | WA | 0ms | 3596kb | C++20 | 913b | 2024-09-09 06:02:38 | 2024-09-09 06:02:39 |
Judging History
answer
#include <bits/stdc++.h>
void solve() {
int n;
std::cin >> n;
int x = 0;
std::vector<int> a(n);
for (int i = 0; i < n; i++) {
std::cin >> a[i];
x ^= a[i];
}
if (x) {
std::cout << "YES\n";
std::cout << 1 << " " << 1 << "\n";
std::cout << 2 << " " << n << "\n";
return;
}
x = 0;
for (int i = 1; i < n; i++) {
x ^= a[i];
if (x != 0 && x != a[0]) {
std::cout << "YES\n";
std::cout << 1 << " " << 1 << "\n";
std::cout << 2 << " " << i + 1 << "\n";
std::cout << i + 2 << " " << n << "\n";
return;
}
}
std::cout << "NO\n";
}
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
int t;
std::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: 3596kb
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)