#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize ("unroll-loops,Ofast,O3")
#pragma GCC target("avx,avx2,fma")
#define F first
#define S second
#define int long long
#define sz(x) (int)x.size()
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define NFS ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0) ;
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)
const int E = (int)1e6+777;
const int N = (int)4e3;
int n, a[E];
void solve1(int res = 0){
for(int i = 1; i <= n; ++i){
for(int j = i; j <= n; ++j){
res ^= (a[i] + a[j]);
}
}
cout << res;
exit(false);
}
void solve2(int res = 0){
vector<int> cnt(N, 0);
for(int i = 1; i <= n; ++i){
++cnt[a[i]];
}
for(int i = 1; i <= N; ++i){
for(int j = i; j <= N; ++j){
int cur = min(cnt[i], cnt[j]);
if(cur & 1) res ^= (i + j);
}
}
cout << res;
exit(false);
}
signed main(){
cin >> n;
for(int i = 1; i <= n; ++i){
cin >> a[i];
}
if(n <= 4 * 1000){
solve1();
}
solve2();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
312 KB |
Output is correct |
2 |
Correct |
6 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
239 ms |
8080 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
239 ms |
8080 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
312 KB |
Output is correct |
2 |
Correct |
6 ms |
332 KB |
Output is correct |
3 |
Runtime error |
41 ms |
1948 KB |
Execution killed with signal 11 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
312 KB |
Output is correct |
2 |
Correct |
6 ms |
332 KB |
Output is correct |
3 |
Incorrect |
239 ms |
8080 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |