QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#554108#5521. Excellent XOR ProblemRichw818WA 0ms3596kbC++20913b2024-09-09 06:02:382024-09-09 06:02:39

Judging History

你现在查看的是最新测评结果

  • [2024-09-09 06:02:39]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3596kb
  • [2024-09-09 06:02:38]
  • 提交

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)