# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
67751 | 2018-08-15T09:31:23 Z | ekrem | XOR Sum (info1cup17_xorsum) | C++ | 1600 ms | 4232 KB |
#include <bits/stdc++.h> #define st first #define nd second #define mp make_pair #define pb push_back #define N 1000005 using namespace std; int n, a[N], top, ans, ans2; void yz(int bit){ if(bit == 0)return; yz(bit/2); printf("%d",bit%2); } void yaz(int bit){ yz(bit); puts(""); } int main() { // freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); scanf("%d",&n); for(int i = 1; i <= n; i++){ scanf("%d", a + i); // yaz(a[i]); top += a[i]; } // cout << "AMK" << ((a[1] + a[2])^(a[1] + a[1])) << endl; // cout <<(a[1]^a[2]) << endl; // puts(""); for(int i = 1; i <= n; i++) ans ^= (1 - n%2)*a[i]; for(int i = 1; i <= n; i++) for(int j = i; j <= n; j++){ int zorla = 0; for(int k = 0; (1<<k) <= a[i] or (1<<k) <= a[j]; k++){ if(a[i]&(1<<k) and a[j]&(1<<k)) zorla |= (1<<k); if(k > 0 and (a[i]|a[j])&(1<<k) and zorla & (1<<(k - 1))) zorla |= (1<<k); } // yaz(a[i]); // yaz(a[j]); // yaz(a[i] + a[j]); // // yaz( (a[i]|a[j])*2 ); // yaz(a[i]^a[j] ^ ((zorla)*2) ); // puts(""); ans ^= ((zorla)*2); } // yaz(ans); // yaz(ans2); printf("%d\n",ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1524 ms | 376 KB | Output is correct |
2 | Correct | 1466 ms | 396 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1668 ms | 4232 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1668 ms | 4232 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1524 ms | 376 KB | Output is correct |
2 | Correct | 1466 ms | 396 KB | Output is correct |
3 | Execution timed out | 1654 ms | 4232 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1524 ms | 376 KB | Output is correct |
2 | Correct | 1466 ms | 396 KB | Output is correct |
3 | Execution timed out | 1668 ms | 4232 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |