답안 #128998

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
128998 2019-07-11T12:08:44 Z TAISA_ XOR Sum (info1cup17_xorsum) C++14
7 / 100
109 ms 8952 KB
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr double eps = 1e-9;
constexpr ll MOD = 1000000007LL;
template <typename T> bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T> bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T> ostream &operator<<(ostream &os, vector<T> v) {
    for (int i = 0; i < v.size(); i++) {
        os << v[i] << (i + 1 == v.size() ? "\n" : " ");
    }
    return os;
}
template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) {
    t = v;
}
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) {
    for (auto &e : t) {
        fill_v(e, v);
    }
};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int x = 0;
    if (n <= 4000) {
        for (int i = 0; i < n; i++) {
            for (int j = i; j < n; j++) {
                x ^= (a[i] + a[j]);
            }
        }
    } else {
        vector<int> co(4010);
        for (int i = 0; i < n; i++) {
            co[a[i]]++;
        }
        int x = 0;
        for (int i = 1; i <= 4000; i++) {
            if (co[i] == 0 || co[i] % 4 == 0 || (co[i] - 1) % 4 == 0) {
                continue;
            }
            x ^= 2 * i;
            for (int j = i + 1; j <= 4000; j++) {
                if (co[j] == 0 || co[i] % 2 == 0 || co[j] % 2 == 0) {
                    continue;
                }
                x ^= (i + j);
            }
        }
    }
    cout << x << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 376 KB Output is correct
2 Correct 9 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 109 ms 8952 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 109 ms 8952 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 376 KB Output is correct
2 Correct 9 ms 376 KB Output is correct
3 Runtime error 18 ms 2268 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 376 KB Output is correct
2 Correct 9 ms 376 KB Output is correct
3 Incorrect 109 ms 8952 KB Output isn't correct
4 Halted 0 ms 0 KB -