QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#78588 | #5521. Excellent XOR Problem | BoaHancock | WA | 2ms | 3468kb | C++20 | 1.2kb | 2023-02-19 16:59:49 | 2023-02-19 16:59:53 |
Judging History
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)