# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1114381 | 2024-11-18T17:53:16 Z | ttamx | XOR Sum (info1cup17_xorsum) | C++17 | 437 ms | 27240 KB |
#include<bits/stdc++.h> using namespace std; const int B=1<<30; int main(){ cin.tie(nullptr)->sync_with_stdio(false); int n; cin >> n; vector<int> a(n); for(auto &x:a){ cin >> x; } int ans=0; for(int b=1;b<B;b<<=1){ vector<int> l,r; for(auto x:a){ ((x&b)?r:l).emplace_back(x); } int c=0; int filter=b*2-1; auto f=[&](int x){ return x&(filter); }; for(int t=0;t<2;t++){ for(int i=l.size()-1,p=0;i>=0;i--){ while(p<l.size()&&!((f(l[i])+f(l[p]))&b)){ p++; } if(p<=i){ c^=(i-p+1)&1; } } swap(l,r); } for(int i=r.size()-1,p=0;i>=0;i--){ while(p<l.size()&&((f(r[i])+f(l[p]))&b)){ p++; } c^=p&1; } ans|=c*b; l.insert(l.end(),r.begin(),r.end()); a=move(l); } cout << ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 336 KB | Output is correct |
2 | Correct | 3 ms | 336 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 212 ms | 19048 KB | Output is correct |
2 | Correct | 207 ms | 17028 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 212 ms | 19048 KB | Output is correct |
2 | Correct | 207 ms | 17028 KB | Output is correct |
3 | Correct | 287 ms | 19052 KB | Output is correct |
4 | Correct | 298 ms | 23884 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 336 KB | Output is correct |
2 | Correct | 3 ms | 336 KB | Output is correct |
3 | Correct | 47 ms | 2408 KB | Output is correct |
4 | Correct | 48 ms | 3332 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 336 KB | Output is correct |
2 | Correct | 3 ms | 336 KB | Output is correct |
3 | Correct | 212 ms | 19048 KB | Output is correct |
4 | Correct | 207 ms | 17028 KB | Output is correct |
5 | Correct | 287 ms | 19052 KB | Output is correct |
6 | Correct | 298 ms | 23884 KB | Output is correct |
7 | Correct | 47 ms | 2408 KB | Output is correct |
8 | Correct | 48 ms | 3332 KB | Output is correct |
9 | Correct | 409 ms | 27236 KB | Output is correct |
10 | Correct | 424 ms | 27240 KB | Output is correct |
11 | Correct | 437 ms | 27184 KB | Output is correct |