Submission #1115086

# Submission time Handle Problem Language Result Execution time Memory
1115086 2024-11-20T03:16:59 Z 12345678 XOR Sum (info1cup17_xorsum) C++17
0 / 100
253 ms 20816 KB
#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 time Memory Grader output
1 Incorrect 15 ms 20816 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 253 ms 19596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 253 ms 19596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 20816 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 20816 KB Output isn't correct
2 Halted 0 ms 0 KB -