# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
97865 | 2019-02-19T06:46:15 Z | mohammedehab2002 | XOR Sum (info1cup17_xorsum) | C++11 | 728 ms | 16180 KB |
#include <iostream> #include <algorithm> #include <vector> using namespace std; vector<int> v; int f(unsigned int x) { int r=v.size(),ans=0; for (int l=0;l<v.size();l++) { r=max(r,l); while (r>l && v[l]+v[r-1]>=x) r--; ans+=r-l; } return ans; } int main() { int n,ans=0; scanf("%d",&n); for (int i=0;i<n;i++) { int a; scanf("%d",&a); v.push_back(a); } sort(v.begin(),v.end()); for (unsigned int i=(1<<29);i;i/=2) { vector<int> v1,v2; for (int j:v) { if (j<2*i) v1.push_back(j); else v2.push_back(j-2*i); } v.clear(); merge(v1.begin(),v1.end(),v2.begin(),v2.end(),back_inserter(v)); int cnt=f(4*i)-f(3*i)+f(2*i)-f(i); ans+=i*(cnt%2); } printf("%d",ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 6 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 728 ms | 16180 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 728 ms | 16180 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 6 ms | 384 KB | Output is correct |
3 | Incorrect | 80 ms | 2508 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 6 ms | 384 KB | Output is correct |
3 | Incorrect | 728 ms | 16180 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |