답안 #1088266

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1088266 2024-09-14T07:30:04 Z vahagng XOR Sum (info1cup17_xorsum) C++17
11 / 100
1600 ms 131072 KB
#include <bits/stdc++.h>
using namespace std;

#ifndef ONLINE_JUDGE
#define dbg(x) cerr << #x <<" "; print(x); cerr << endl;
#else
#define dbg(x)
#endif

void print(long long t) {cerr << t;}
void print(int t) {cerr << t;}
void print(string t) {cerr << t;}
void print(char t) {cerr << t;}
void print(double t) {cerr << t;}
void print(long double t) {cerr << t;}
void print(unsigned long long t) {cerr << t;}

template <class T, class V> void print(pair <T, V> p);
template <class T> void print(vector <T> v);
template <class T> void print(set <T> v);
template <class T, class V> void print(map <T, V> v);
template <class T> void print(multiset <T> v);
template <class T, class V> void print(T v[],V n) {cerr << "["; for(int i = 0; i < n; i++) {cerr << v[i] << " ";} cerr << "]";}
template <class T, class V> void print(pair <T, V> p) {cerr << "{"; print(p.first); cerr << ","; print(p.second); cerr << "}";}
template <class T> void print(vector <T> v) {cerr << "[ "; for (T i : v) {print(i); cerr << " ";} cerr << "]";}
template <class T> void print(set <T> v) {cerr << "[ "; for (T i : v) {print(i); cerr << " ";} cerr << "]";}
template <class T> void print(multiset <T> v) {cerr << "[ "; for (T i : v) {print(i); cerr << " ";} cerr << "]";}
template <class T, class V> void print(map <T, V> v) {cerr << "[ "; for (auto i : v) {print(i); cerr << " ";} cerr << "]";}

#define ll long long
#define all(v) v.begin(),v.end()
#define endl '\n'

const int N = 1e6 + 10;

ll n, a[N], ans;

map<ll,ll>mp;

void solve(){
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        mp[a[i]]++;
    }
    map<ll,ll>cnt;
    auto it = mp.begin();
    for(auto i : mp){
        for(auto j = next(it); j != mp.end(); j++){
            cnt[(j->first + i.first)] += (j->second * i.second);
        }
        it++;
        cnt[(i.first + i.first)] += i.second;
        cnt[(i.first + i.first)] += (i.second * (i.second-1))/2;
    }
    for(auto i : cnt){
        if(i.second & 1){
            ans ^= i.first;
        }
    }
    cout << ans << endl;
}

int main(){
    int t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1181 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 760 ms 8992 KB Output is correct
2 Correct 742 ms 8548 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 760 ms 8992 KB Output is correct
2 Correct 742 ms 8548 KB Output is correct
3 Execution timed out 1633 ms 104612 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1181 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1181 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -