#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];
}
}
//cout<<j<<" "<<cnt<<endl;
if(cnt%2==1)ans+=(1<<j);
}
cout<<ans<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
176 ms |
16092 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
718 ms |
24632 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
718 ms |
24632 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
176 ms |
16092 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
176 ms |
16092 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |