답안 #270090

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
270090 2020-08-17T12:25:16 Z Atill83 XOR Sum (info1cup17_xorsum) C++14
11 / 100
103 ms 512 KB
#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 <= 2){
        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
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 103 ms 384 KB Output is correct
2 Correct 102 ms 424 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 103 ms 384 KB Output is correct
2 Correct 102 ms 424 KB Output is correct
3 Runtime error 1 ms 512 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -