QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#137190 | #5521. Excellent XOR Problem | The_Hallak# | WA | 88ms | 17372kb | C++17 | 943b | 2023-08-10 03:36:36 | 2023-08-10 03:36:38 |
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 + 1 << '\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;
}
/*
*/
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3524kb
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 2 3 3 YES 2 1 1 2 5 NO
result:
ok Correct (4 test cases)
Test #2:
score: 0
Accepted
time: 8ms
memory: 4580kb
input:
1 200000 0 0 104990627 0 104990627 0 0 0 0 104990627 0 104990627 0 0 104990627 104990627 0 0 0 0 0 104990627 0 0 0 104990627 104990627 104990627 0 104990627 0 104990627 104990627 0 104990627 0 0 0 104990627 104990627 0 0 104990627 104990627 0 0 104990627 0 0 0 0 0 104990627 104990627 0 0 0 0 0 10499...
output:
YES 2 1 1 2 200000
result:
ok Correct (1 test case)
Test #3:
score: 0
Accepted
time: 88ms
memory: 17344kb
input:
1 200000 916550535 1039111536 183367143 845311658 473404911 844600350 249761080 860927112 268559756 661297994 448456545 184790162 804023458 655065019 442145717 130497524 509071033 644651807 1039510287 766490362 514960668 612238468 863513676 417538457 839195481 901404895 760875212 983171045 343221187...
output:
YES 3 1 1 2 2 3 200000
result:
ok Correct (1 test case)
Test #4:
score: 0
Accepted
time: 85ms
memory: 17372kb
input:
1 200000 697100980 63360185 3577101 75632048 903073319 644702701 1017474476 268785811 6091842 227390753 270800416 554896940 318364388 526066510 354510498 1034952286 613138496 176305121 384248064 715019967 999545181 91222841 1063728923 665773338 354670745 473570604 220064105 301115885 1038664738 3094...
output:
YES 2 1 1 2 200000
result:
ok Correct (1 test case)
Test #5:
score: -100
Wrong Answer
time: 13ms
memory: 4660kb
input:
1 200000 446225258 446225258 446225258 446225258 0 0 446225258 446225258 0 446225258 0 0 446225258 0 446225258 0 446225258 446225258 446225258 0 446225258 0 0 446225258 0 0 446225258 446225258 446225258 446225258 0 0 0 446225258 0 446225258 446225258 0 0 0 0 446225258 446225258 446225258 446225258 0...
output:
YES 3 1 1 2 2 3 200000
result:
FAIL all xors must be different (test case 1)