QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#78588#5521. Excellent XOR ProblemBoaHancockWA 2ms3468kbC++201.2kb2023-02-19 16:59:492023-02-19 16:59:53

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-19 16:59:53]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3468kb
  • [2023-02-19 16:59:49]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve() {
    int n;
    cin >> n;
    vector<int> v(n + 1), xsum(n + 1, 0);
    for(int i = 1;i <= n; ++ i) {
        cin >> v[i];
        xsum[i] = xsum[i - 1] ^ v[i];
    }
    cout << v[n] << '\n';
    if(xsum[n] == 0) {
        int id = n;
        while(xsum[id] == 0) {
            -- id;
        }
        for(int i = 1; i < id; ++ i) {
            int x = xsum[i];
            int y = xsum[id - 1] ^ x;
            if(x != 0 && x != y && y == 0) {
                cout << "Yes" << '\n' << 3 << '\n';
                cout << 1 << ' ' << i << '\n' << i + 1 << ' ' << id << '\n' << id + 1 << ' ' << n << '\n';
                return;
            }
        }
    }
    int x, y;
    for(int i = 1; i < n; ++ i) {
        x = xsum[i];
        y = xsum[n] ^ x;
        if(x != y) {
            cout << "Yes" << '\n' << 2 << '\n';
            cout << 1 << ' ' << i << '\n' << i + 1 << ' ' << n << '\n';
            return;
        }
    }
    cout << "No" << '\n';
}

int32_t main() {
    int T = 1;
    cin >> T;
    while(T --) {
        solve();
    }
    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3468kb

input:

4
2
0 0
3
1 2 3
5
16 8 4 2 1
6
42 42 42 42 42 42

output:

0
No
3
Yes
3
1 1
2 2
3 3
1
Yes
2
1 1
2 5
42
No

result:

wrong answer Token parameter [name=yes/no] equals to "0", doesn't correspond to pattern "[yY][eE][sS]|[nN][oO]" (test case 1)