#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mx=4*1000;
int main(){
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int n,x=0; cin >> n;
int a[n+1];
unordered_map<int,int> mp;
for(int i=1;i<=n;++i) {
cin >> a[i];
mp[a[i]]++;
}
if(n<=mx) {
for(int i=1;i<=n;++i) {
for(int j=i;j<=n;++j) {
x^=(a[i]+a[j]);
}
}
return cout<<x,0;
}
for(int i=1;i<=mx;++i) {
if(!mp[i]) continue;
if((mp[i]*(mp[i]+1)/2)%2) {
x^=(i*2);
}
for(int j=i+1;j<=mx;++j) {
if(mp[i]&&mp[j]&&(mp[i]*mp[j]%2==1)) {
x^=(i+j);
}
}
}
cout << x;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
604 KB |
Output is correct |
2 |
Correct |
5 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
226 ms |
4440 KB |
Output is correct |
2 |
Correct |
218 ms |
4188 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
226 ms |
4440 KB |
Output is correct |
2 |
Correct |
218 ms |
4188 KB |
Output is correct |
3 |
Incorrect |
425 ms |
27228 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
604 KB |
Output is correct |
2 |
Correct |
5 ms |
604 KB |
Output is correct |
3 |
Incorrect |
20 ms |
6352 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
604 KB |
Output is correct |
2 |
Correct |
5 ms |
604 KB |
Output is correct |
3 |
Correct |
226 ms |
4440 KB |
Output is correct |
4 |
Correct |
218 ms |
4188 KB |
Output is correct |
5 |
Incorrect |
425 ms |
27228 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |