제출 #799550

#제출 시각아이디문제언어결과실행 시간메모리
799550Darren0724XOR Sum (info1cup17_xorsum)C++17
0 / 100
1522 ms12752 KiB
#pragma GCC optimize("Ofast","O3","unroll-loops")
#pragma GCC target("avx2")
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define rz resize
#define pb emplace_back
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
#define ACorz ios_base::sync_with_stdio(false);cin.tie(0);
//#define endl '\n'
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
const int INF=1e18,INF2=2e9;
const int mod=1e9+7;
const int mod1=998244353;
const int N=100;
const int K=45000;
const int M=5000;

signed main(){
    ACorz;
    int n;cin>>n;
    vector<int> v(n);
    
    int ans=0;
    for(int i=0;i<n;i++){
        cin>>v[i];
        if(n&1){
            ans^=v[i];
        }
    }
    int p=2;
    for(int i=1;i<=30;i++){
        vector<int> a(n);
        for(int j=0;j<n;j++){
            a[j]=v[j]%p;
        }
        sort(all(a));
        int cnt=0;
        int t=n-1;
        for(int j=0;j<n;j++){
            while(t>=0&&a[t]+a[j]>=p){
                t--;
            }
            cnt+=(n-1-t);
        }
        if(cnt&1){
            ans^=p;
        }
        p<<=1;
    }
    cout<<ans<<endl;

    
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

xorsum.cpp:15:15: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   15 | const int INF=1e18,INF2=2e9;
      |               ^~~~
#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...