#pragma GCC optimize("Ofast","O3","unroll-loops")
#pragma GCC target("avx2")
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define rz resize
#define pb emplace_back
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
#define ACorz ios_base::sync_with_stdio(false);cin.tie(0);
//#define endl '\n'
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
const int INF=1e9,INF2=2e9;
const int mod=1e9+7;
const int mod1=998244353;
const int N=100;
const int K=45000;
const int M=5000;
signed main(){
ACorz;
int n;cin>>n;
vector<int> v(n);
int ans=0;
for(int i=0;i<n;i++){
cin>>v[i];
if(n%2==0){
ans^=v[i];
}
}
int p=2;
for(int i=1;i<=30;i++){
vector<int> a(n);
for(int j=0;j<n;j++){
a[j]=v[j]%p;
}
sort(all(a));
int cnt=0;
int t=n-1;
for(int j=0;j<n;j++){
while(t>=0&&a[t]+a[j]>=p){
t--;
}
cnt+=(n-1-t);
}
for(int j=0;j<n;j++){
if(a[j]+a[j]>=p){
cnt++;
}
}
cnt/=2;
//cout<<cnt<<endl;
if(cnt&1){
ans^=p;
}
p<<=1;
}
cout<<ans<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
340 KB |
Output is correct |
2 |
Correct |
7 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1581 ms |
9812 KB |
Output is correct |
2 |
Correct |
1419 ms |
11908 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1581 ms |
9812 KB |
Output is correct |
2 |
Correct |
1419 ms |
11908 KB |
Output is correct |
3 |
Execution timed out |
1617 ms |
14856 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
340 KB |
Output is correct |
2 |
Correct |
7 ms |
336 KB |
Output is correct |
3 |
Correct |
205 ms |
2032 KB |
Output is correct |
4 |
Correct |
208 ms |
2036 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
340 KB |
Output is correct |
2 |
Correct |
7 ms |
336 KB |
Output is correct |
3 |
Correct |
1581 ms |
9812 KB |
Output is correct |
4 |
Correct |
1419 ms |
11908 KB |
Output is correct |
5 |
Execution timed out |
1617 ms |
14856 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |