Submission #440539

# Submission time Handle Problem Language Result Execution time Memory
440539 2021-07-02T11:46:34 Z zxcvbnm XOR Sum (info1cup17_xorsum) C++14
7 / 100
1600 ms 8836 KB
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }

    vector<int> cnt(32, 0);
    vector<int> p(32);
    p[0] = 1;
    for(int i = 1; i < 31; i++) {
        p[i] = p[i-1] * 2;
//        cout << p[i] << "\n";
    }

    for(int i = 0; i < n; i++) {
        for(int j = i; j < n; j++) {
            int x = a[i] + a[j];
//            cout << x << "\n";
            for(int k = 0; k < 31; k++) {
                if (x & (p[k])) {
                    cnt[k]++;
                }
            }
        }
    }
    ll ans = 0;
    for(int i = 0; i < 31; i++) {
        if (cnt[i] % 2) {
            ans += p[i];
        }
    }
    cout << ans << "\n";
//    for(int i = 0; i < n; i++) {
//        for(int j = 0; j < 31; j++) {
//            if (a[i] & p[j]) {
//                cnt[j]++;
//            }
//        }
//    }
//    for(int i = 0; i < 6; i++) {
//        cout << cnt[i] << " ";
//    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1450 ms 348 KB Output is correct
2 Correct 1447 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1693 ms 8836 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1693 ms 8836 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1450 ms 348 KB Output is correct
2 Correct 1447 ms 348 KB Output is correct
3 Execution timed out 1687 ms 1600 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1450 ms 348 KB Output is correct
2 Correct 1447 ms 348 KB Output is correct
3 Execution timed out 1693 ms 8836 KB Time limit exceeded
4 Halted 0 ms 0 KB -