제출 #270092

#제출 시각아이디문제언어결과실행 시간메모리
270092Atill83XOR Sum (info1cup17_xorsum)C++14
18 / 100
108 ms512 KiB
#include <bits/stdc++.h>
#define ff first
#define ss second
#define endl '\n'
using namespace std;
const long long INF = (long long) 1e18;
const int mod = (int) 1e9+7;
const int MAXN = (int) 3e5+5;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll n;
ll v[MAXN];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);cout.tie(nullptr);



    cin>>n;

    if(n <= 4e3){
        ll ans = 0;
        for(int i = 0; i < n; i++){
            cin>>v[i];
            for(int j = 0; j <= i; j++){
                ans ^= (v[i]+v[j]);
            }
        }

        cout<<ans<<endl;
    }else{
        ll ans = 0;
        for(int i = 0; i < n; i++){
            int a;
            cin>>a;
            v[a]++;
        }

        for(int i = 1; i <= 4e3; i++){
            for(int j = 1; j < i; j++){
                ll cnt = 1LL*v[i]*v[j];

                if(cnt % 2){
                    //cout<<i<<endl;
                    ans ^= (i + j);
                }
            }

            if((1LL*v[i]*(v[i] + 1) / 2) % 2){
                ans ^= (2*i);
            }
        }
        cout<<ans<<endl;


    }

    #ifdef Local
        cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds ";
    #endif
}
#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...