Submission #1115086

#TimeUsernameProblemLanguageResultExecution timeMemory
111508612345678XOR Sum (info1cup17_xorsum)C++17
0 / 100
253 ms20816 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const int vx=4e6+5, nx=1e6+5; int n, dp[vx], f[vx], a[nx], ans; int main() { cin.tie(NULL)->sync_with_stdio(false); cin>>n; for (int i=1; i<=n; i++) cin>>a[i]; for (int bit=0; bit<21; bit++) { ll cur=0, res=0, mod=(1<<(bit+1)); for (int i=1; i<=n; i++) f[a[i]%mod]++; for (int i=0; i<(1<<bit); i++) cur+=f[i]; dp[0]=cur; for (int i=1; i<mod; i++) { cur-=f[i-1]; cur+=f[(i+(1<<bit))%mod]; dp[i]=cur; } for (int i=1; i<=n; i++) res+=dp[(((-a[i])%mod)+mod)%mod]; if (res%2) ans+=(1<<bit); for (int i=1; i<=n; i++) f[a[i]%mod]--; } cout<<ans; }
#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...