# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
48550 | Pajaraja | XOR Sum (info1cup17_xorsum) | C++17 | 935 ms | 37680 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int a[1000007],c[1000007];
int main()
{
int n,sol=0;
scanf("%d",&n);
for(int i=1;i<=n;i++) scanf("%d",&a[i]);
for(int j=0;j<31;j++)
{
int b=(1<<j),t=0;
long long bc=0;
if(j) for(int i=1;i<=n;i++) if((a[i] | (1<<(j-1)))!=a[i]) c[++t]=a[i];
if(j) for(int i=1;i<=n;i++) if((a[i] | (1<<(j-1)))==a[i]) c[++t]=a[i];
if(j) for(int i=1;i<=n;i++) {a[i]=c[i]; c[i]=a[i]%b;}
for(int i=1;i<=n;i++) if((a[i] | b) == a[i]) bc++;
long long k=0;
int t1=1,t2=n;
while(t1<=n)
{
while(c[t2]+c[t1]>=b) t2--;
k+=(n-t2);
t1++;
}
for(int i=1;i<=n;i++) if(2*c[i]>=b) k++;
if((k/2+bc*(n-bc))%2==1) sol+=b;
}
printf("%d",sol);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |