Submission #999490

#TimeUsernameProblemLanguageResultExecution timeMemory
999490LOLOLOXOR Sum (info1cup17_xorsum)C++17
0 / 100
17 ms4444 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define f first #define s second #define pb push_back #define ep emplace #define eb emplace_back #define lb lower_bound #define ub upper_bound #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define uniquev(v) sort(all(v)), (v).resize(unique(all(v)) - (v).begin()) #define mem(f,x) memset(f , x , sizeof(f)) #define sz(x) (ll)(x).size() #define __lcm(a, b) (1ll * ((a) / __gcd((a), (b))) * (b)) #define mxx *max_element #define mnn *min_element #define cntbit(x) __builtin_popcountll(x) #define len(x) (int)(x.length()) const int N = 3e5 + 10; int a[N]; int is(vector <int> v, int k) { vector <ll> cnt(3, 0); for (auto x : v) { int c = 0; if (x & (1 << k)) c |= 2; if (k && (x & (1 << (k - 1)))) c |= 1; cnt[c]++; } ll cc = 0; for (int i = 0; i < 3; i++) { for (int j = i + 1; j < 3; j++) { if ((i + j) & 2) { cc += cnt[i] * cnt[j]; } } } return cc % 2; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; int all = 0; for (int i = 1; i <= n; i++) { cin >> a[i]; all ^= (a[i] + a[i]); } int ans = 0; for (int j = 1; j <= 30; j++) { int t = (1 << j); vector <int> v; for (int i = 1; i <= n; i++) { v.pb(a[i] % t); } if (is(v, j)) ans |= (1 << (j - 1)); } ans ^= all; cout << ans << '\n'; 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...