답안 #320473

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
320473 2020-11-08T20:21:30 Z qpwoeirut XOR Sum (info1cup17_xorsum) C++17
7 / 100
108 ms 12772 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int MN = 1001001;
const int BITS = 60;

ll N;
ll A[MN], freq[MN];
ll ct[BITS];
int main() {
    cin.tie(0)->sync_with_stdio(0);

    cin >> N;
    for (int i=0; i<N; ++i) {
        cin >> A[i];
    }

    ll ans = 0;
    if (N <= 4000) {
        for (int i=0; i<N; ++i) {
            for (int j=i; j<N; ++j) {
                ll x = A[i] + A[j];
                ans ^= x;
            }
        }
    } else {
        for (int i=0; i<N; ++i) ++freq[A[i]];
        for (int i=0; i<=4000; ++i) {
            for (int j=0; j<=4000; ++j) {
                ll x;
                if (i == j) {
                    x = (freq[i] * (freq[i] + 1)) >> 1;
                } else {
                    x = freq[i] * freq[j];
                }
                if (x & 1) ans ^= i;
            }
        }
    }

    cout << ans << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 364 KB Output is correct
2 Correct 9 ms 492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 108 ms 12772 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 108 ms 12772 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 364 KB Output is correct
2 Correct 9 ms 492 KB Output is correct
3 Runtime error 15 ms 3052 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 364 KB Output is correct
2 Correct 9 ms 492 KB Output is correct
3 Incorrect 108 ms 12772 KB Output isn't correct
4 Halted 0 ms 0 KB -