Submission #1111131

#TimeUsernameProblemLanguageResultExecution timeMemory
1111131RockyBXOR Sum (info1cup17_xorsum)C++17
7 / 100
1660 ms15048 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 7; int n; int a[N]; int main() { #ifdef wws freopen ("in.txt", "r", stdin); #endif ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } int ans = 0; for (int b = 0; b < 30; b++) { vector<int> v; int m = (1 << (b + 1)); for (int i = 0; i < n; i++) { v.push_back(a[i] % m); // cout << v.back() << ' '; } // cout << endl; int cnt = 0; for (int i = 0; i < n; i++) { for (int j = i; j < n; j++) { if ((v[i] + v[j]) % m >= m / 2) { ++cnt; } } } // cout << cnt << endl; if (cnt & 1) { ans += (1 << b); } } cout << ans; } /* m = 2^ (x+ 1) bits: [0...b] 0 ... 2^b - 1 m - 1 >= vi + vj >= m / 2 */
#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...