제출 #141164

#제출 시각아이디문제언어결과실행 시간메모리
141164meatrowXOR Sum (info1cup17_xorsum)C++17
0 / 100
1701 ms15992 KiB
//#pragma GCC optimize("O3") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native") //#pragma GCC optimize ("unroll-loops") #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; const int M = 20; const int N = 3e6; int a[N]; int f[N]; void add(int pos) { for (; pos < N; pos |= pos + 1) { f[pos]++; } } int get(int pos) { int res = 0; for (; pos >= 0; pos = (pos & (pos + 1)) - 1) { res += f[pos]; } return res; } int get(int l, int r) { if (l > r) { return 0; } return get(r) - get(l - 1); } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } int ans = 0; int pw = 2; for (int b = 0; b < M; b++) { fill(f, f + N, 0); int kek = 0; for (int i = 0; i < n; i++) { int t = a[i] & (pw - 1); add(t); if (a[i] & (1 << b)) { kek += get(0, pw - 1 - t) + get(pw - t + pw / 2, pw - 1); kek &= 1; } else { kek += get(pw / 2 - t, pw - 1 - t); kek &= 1; } } if (kek) { ans += pw >> 1; } pw <<= 1; } cout << ans; return 0; }
#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...