# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1026113 | 2024-07-17T15:19:52 Z | Tob | XOR Sum (info1cup17_xorsum) | C++14 | 282 ms | 22704 KB |
#include <bits/stdc++.h> #define F first #define S second #define all(x) x.begin(), x.end() #define pb push_back #define FIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0) using namespace std; typedef long long ll; typedef pair <ll, ll> pii; const int N = 1e6 + 7, B = 30; int n, res; int a[N]; int main () { FIO; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; if (n % 2 == 0) for (int i = 0; i < n; i++) res ^= a[i]; for (int i = 1; i < B; i++) { vector <int> v[2]; for (int j = 0; j < n; j++) v[(a[j] >> i-1) & 1].pb(a[j]); int k = v[1].size(); int o = ((k&3)==1||(k&3)==2); k--; for (int j = 0; j < v[0].size(); j++) { while (k >= 0 && (v[0][j] & (1 << i)-1) + (v[1][k] & (1 << i)-1) >= (1 << i)) k--; o ^= (int(v[1].size())-k-1)&1; a[j] = v[0][j]; } for (int j = 0; j < v[1].size(); j++) a[v[0].size()+j] = v[1][j]; res ^= (o << i); } cout << res << "\n"; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 484 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 214 ms | 17672 KB | Output is correct |
2 | Correct | 196 ms | 16208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 214 ms | 17672 KB | Output is correct |
2 | Correct | 196 ms | 16208 KB | Output is correct |
3 | Correct | 235 ms | 20020 KB | Output is correct |
4 | Correct | 214 ms | 19480 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 484 KB | Output is correct |
3 | Correct | 27 ms | 2608 KB | Output is correct |
4 | Correct | 27 ms | 2608 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 484 KB | Output is correct |
3 | Correct | 214 ms | 17672 KB | Output is correct |
4 | Correct | 196 ms | 16208 KB | Output is correct |
5 | Correct | 235 ms | 20020 KB | Output is correct |
6 | Correct | 214 ms | 19480 KB | Output is correct |
7 | Correct | 27 ms | 2608 KB | Output is correct |
8 | Correct | 27 ms | 2608 KB | Output is correct |
9 | Correct | 273 ms | 22568 KB | Output is correct |
10 | Correct | 267 ms | 22676 KB | Output is correct |
11 | Correct | 282 ms | 22704 KB | Output is correct |