답안 #799552

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
799552 2023-07-31T15:56:58 Z Darren0724 XOR Sum (info1cup17_xorsum) C++17
0 / 100
1485 ms 8148 KB
#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];
    }
    int p=2;
    for(int i=1;i<=29;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;
}

Compilation message

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;
      |               ^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 352 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1485 ms 8148 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1485 ms 8148 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 352 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 352 KB Output isn't correct
2 Halted 0 ms 0 KB -