#include <bits/stdc++.h>
using namespace std;
int main()
{
cin.tie(0)->sync_with_stdio(0);
// freopen("div7.in", "r", stdin);
// freopen("div7.out", "w", stdout);
int n;
cin >> n;
if(n <= 4e3){
vector<int>v(n);
for(int i = 0; i < n; i++) {cin >> v[i];}
int ans = 0;
for(int i = 0; i < n; i++) {
for(int e = i; e < n; e++) {
ans ^= v[i] + v[e];
}
}
cout << ans;
return 0;
}
map<int, int>mp;
vector<int>v(n);
for(int i = 0;i < n;++i){
cin >> v[i];
}
int ans = 0;
for(int i = 0;i < n;++i){
if(mp.count(v[i])){
ans ^= mp[v[i]];
continue;
}
int res = 0;
for(int j = i;j < n;++j){
res ^= (v[i] + v[j]);
ans ^= (v[i] + v[j]);
}
mp[v[i]] = res;
}
cout << ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
212 KB |
Output is correct |
2 |
Correct |
5 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1671 ms |
4544 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1671 ms |
4544 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
212 KB |
Output is correct |
2 |
Correct |
5 ms |
212 KB |
Output is correct |
3 |
Execution timed out |
1665 ms |
2388 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
212 KB |
Output is correct |
2 |
Correct |
5 ms |
212 KB |
Output is correct |
3 |
Execution timed out |
1671 ms |
4544 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |