제출 #1146435

#제출 시각아이디문제언어결과실행 시간메모리
1146435crispxxXOR Sum (info1cup17_xorsum)C++20
18 / 100
48 ms4168 KiB
/** * author: a.k * created: idk **/ #include <bits/stdc++.h> using namespace std; #define all(x) x.begin(), x.end() #define pb push_back #define nl '\n' const int N = 4e3 + 1; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<int> a(n); for(auto &u : a) cin >> u; if(n <= N) { int res = 0; for(int i = 0; i < n; i++) { for(int j = i; j < n; j++) { res ^= (a[i] + a[j]); } } cout << res << nl; } else if(*max_element(all(a)) <= N) { vector<int> cnt(N), ans(2 * N); for(auto u : a) cnt[u]++; for(int i = 0; i < N; i++) { for(int j = i; j < N; j++) { if(i == j) { int u = cnt[i]; if((u * 1LL * (u + 1) / 2) & 1) ans[i + j] ^= 1; } else { int u = cnt[i], v = cnt[j]; if((u * 1LL * v) & 1) ans[i + j] ^= 1; } } } int res = 0; for(int i = 0; i < 2 * N; i++) { if(ans[i]) res ^= i; } cout << res << nl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...