#include<bits/stdc++.h>
using namespace std;
const int MAXN=2e6+6;
const int logN=20;
int n,ans;
int a[MAXN];
int pref[2][MAXN];
int main()
{
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i];
}
for(int j=0;j<logN;j++)
{
//cout<<j<<endl;
memset(pref,0,sizeof(pref));
for(int i=1;i<=n;i++)
{
if(a[i]&(1<<j))
{
pref[1][a[i]%(1<<j)]++;
}
else
{
pref[0][a[i]%(1<<j)]++;
}
}
for(int j=1;j<MAXN;j++)
{
pref[0][j]+=pref[0][j-1];
pref[1][j]+=pref[1][j-1];
}
int cnt=0;
for(int i=1;i<=n;i++)
{
int t=a[i]%(1<<j);
if(a[i]&(1<<j))
{
if((1<<j)-t-1>=0)cnt+=pref[0][(1<<j)-t-1];
cnt+=pref[1][MAXN-1]-pref[1][(1<<j)-t-1];
}
else
{
if((1<<j)-t-1>=0)cnt+=pref[1][(1<<j)-t-1];
cnt+=pref[0][MAXN-1]-pref[0][(1<<j)-t-1];
}
if((a[i]*2)&(1<<j))cnt++;
}
if((cnt/2)%2==1)ans+=(1<<j);
}
cout<<ans<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
183 ms |
15980 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
702 ms |
21232 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
702 ms |
21232 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
183 ms |
15980 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
183 ms |
15980 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |