#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MN = 1001001;
const int BITS = 60;
ll N;
ll A[MN], freq[MN];
ll ct[BITS];
int main() {
cin.tie(0)->sync_with_stdio(0);
cin >> N;
for (int i=0; i<N; ++i) {
cin >> A[i];
}
ll ans = 0;
if (N <= 4000) {
for (int i=0; i<N; ++i) {
for (int j=i; j<N; ++j) {
ll x = A[i] + A[j];
ans ^= x;
}
}
} else {
for (int i=0; i<N; ++i) ++freq[A[i]];
for (int i=0; i<=4000; ++i) {
for (int j=0; j<=4000; ++j) {
ll x;
if (i == j) {
x = (freq[i] * (freq[i] + 1)) >> 1;
} else {
x = freq[i] * freq[j];
}
if (x & 1) ans ^= i;
}
}
}
cout << ans << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
364 KB |
Output is correct |
2 |
Correct |
9 ms |
492 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
108 ms |
12772 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
108 ms |
12772 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
364 KB |
Output is correct |
2 |
Correct |
9 ms |
492 KB |
Output is correct |
3 |
Runtime error |
15 ms |
3052 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
364 KB |
Output is correct |
2 |
Correct |
9 ms |
492 KB |
Output is correct |
3 |
Incorrect |
108 ms |
12772 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |