#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<int, int> pii;
typedef pair<ld, ld> pld;
int ans = 0;
map<int, int> mpp;
int n;
vector<int> v;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
//freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
cin >> n;
while(n--){
int tmp;
cin >> tmp;
mpp[tmp]++;
}
for(auto u : mpp){
if((u.ss-1)%4 == 0 || u.ss%4 == 2){
ans ^= 2*u.ff;
}
if(u.ss%2)
v.pb(u.ff);
}
n = v.size();
for(int i = 0; i < n; ++i)
for(int j = i+1; j < n; ++j)
ans ^= v[i]+v[j];
cout << ans << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
640 KB |
Output is correct |
2 |
Correct |
8 ms |
640 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
221 ms |
5116 KB |
Output is correct |
2 |
Correct |
182 ms |
4856 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
221 ms |
5116 KB |
Output is correct |
2 |
Correct |
182 ms |
4856 KB |
Output is correct |
3 |
Execution timed out |
1676 ms |
34868 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
640 KB |
Output is correct |
2 |
Correct |
8 ms |
640 KB |
Output is correct |
3 |
Execution timed out |
1681 ms |
6644 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
640 KB |
Output is correct |
2 |
Correct |
8 ms |
640 KB |
Output is correct |
3 |
Correct |
221 ms |
5116 KB |
Output is correct |
4 |
Correct |
182 ms |
4856 KB |
Output is correct |
5 |
Execution timed out |
1676 ms |
34868 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |