Submission #646238

# Submission time Handle Problem Language Result Execution time Memory
646238 2022-09-29T09:28:46 Z murad_2005 XOR Sum (info1cup17_xorsum) C++14
18 / 100
1600 ms 36432 KB
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned long long
#define ui unsigned int
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define pb push_back
#define pf push_front
#define pii pair<int, int>
#define pil pair<int, ll>
#define plli pair<long long, int>
#define pdi pair<double, int>
#define pldldi pair<ld, pair<ld, int>>
#define pdd pair<double, double>
#define pid pair<int, double>
#define piii pair<int, pair<int, int>>
#define pllll pair<long long, long long>
#define pllllll pair<ll, pllll>
#define INF 2e9 + 5
#define size(v) v.size()
#define f first
#define s second
#define Pi 3.14159265359

using namespace std;

const int up = 4e3;

void solve(){
    int n;
    cin >> n;
    vector<int>a(n);
    map<int, int>mp;
    for(int i = 0; i < n; ++i){
        cin >> a[i];
        mp[a[i]]++;
    }
    ll Res = 0;
    for(auto i = mp.begin(); i != mp.end(); i++){
        for(auto j = i; j != mp.end(); j++){
            if(i == j){
                int c = i->f;
                int x = i->s;
                if(x & 1){
                    Res ^= (2ll * c);
                }if((x * (x - 1) / 2) & 1){
                    Res ^= (2ll * c);
                }
            }else{
                int x = i->s, y = j->s;
                if((1ll * x * y) & 1){
                    Res ^= (1ll * (i->f) + (j->f));
                }
            }
        }
    }
    cout << Res;
}

int main(){

    int t;
    t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 76 ms 520 KB Output is correct
2 Correct 76 ms 560 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 396 ms 4748 KB Output is correct
2 Correct 362 ms 8360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 396 ms 4748 KB Output is correct
2 Correct 362 ms 8360 KB Output is correct
3 Execution timed out 1663 ms 36432 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 76 ms 520 KB Output is correct
2 Correct 76 ms 560 KB Output is correct
3 Execution timed out 1627 ms 6220 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 76 ms 520 KB Output is correct
2 Correct 76 ms 560 KB Output is correct
3 Correct 396 ms 4748 KB Output is correct
4 Correct 362 ms 8360 KB Output is correct
5 Execution timed out 1663 ms 36432 KB Time limit exceeded
6 Halted 0 ms 0 KB -