# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1114380 | 2024-11-18T17:52:32 Z | ttamx | XOR Sum (info1cup17_xorsum) | C++17 | 241 ms | 30160 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<n&&!((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 | 241 ms | 23768 KB | Output is correct |
2 | Correct | 231 ms | 21176 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 241 ms | 23768 KB | Output is correct |
2 | Correct | 231 ms | 21176 KB | Output is correct |
3 | Runtime error | 164 ms | 30160 KB | Execution killed with signal 11 |
4 | Halted | 0 ms | 0 KB | - |
# | 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 | Runtime error | 21 ms | 3816 KB | Execution killed with signal 11 |
4 | Halted | 0 ms | 0 KB | - |
# | 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 | 241 ms | 23768 KB | Output is correct |
4 | Correct | 231 ms | 21176 KB | Output is correct |
5 | Runtime error | 164 ms | 30160 KB | Execution killed with signal 11 |
6 | Halted | 0 ms | 0 KB | - |