#include<iostream>
#include<cassert>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<stack>
#include<set>
#include<queue>
#include<map>
using namespace std;
const int N = (int)1e6 + 7;
const int M = (int)1e6 + 7;
const int inf = (int)1e9 + 7;
const int MOD = (int)998244353;
const long long INF = (long long)1e18 + 7;
int mult(int x, int y) {
return 1ll*x*y%MOD;
}
int sum(int x, int y) {
x += y;
if(x >= MOD) {
x -= MOD;
}
return x;
}
int sub(int x, int y) {
x -= y;
if(x < 0) {
x += MOD;
}
return x;
}
int n, a[N], b[N];
long long f(int l, int r) {
long long cur = 0;
for(int i = 1; i <= n; ++i) {
for(int j = 1; j <= i; ++j) {
if(a[i] + a[j] >= l && a[i] + a[j] <= r) {
cur++;
}
}
}
return cur;
}
int main() {
ios_base::sync_with_stdio(NULL);
cin.tie(0);
cin >> n;
for(int i = 1; i <= n; ++i) {
cin >> a[i];
}
int ans = 0;
for(int j = 29; j >= 0; --j) {
long long cur = f((1 << j), (1 << (j+1))-1) + f((1 << j) + (1 << (j+1)), (1 << (j+2))-1);
for(int i = 1; i <= n; ++i) {
if(a[i] >> j & 1) {
a[i] ^= (1 << j);
}
}
if(cur&1) {
ans |= (1 << j);
}
}
cout << ans << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
840 ms |
2528 KB |
Output is correct |
2 |
Correct |
830 ms |
2536 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1682 ms |
10576 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1682 ms |
10576 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
840 ms |
2528 KB |
Output is correct |
2 |
Correct |
830 ms |
2536 KB |
Output is correct |
3 |
Execution timed out |
1618 ms |
5464 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
840 ms |
2528 KB |
Output is correct |
2 |
Correct |
830 ms |
2536 KB |
Output is correct |
3 |
Execution timed out |
1682 ms |
10576 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |