結果

問題 No.1876 Xor of Sum
ユーザー RaffRaff
提出日時 2022-03-17 15:04:05
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 376 ms / 2,000 ms
コード長 1,613 bytes
コンパイル時間 3,719 ms
コンパイル使用メモリ 230,088 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-04-08 19:45:29
合計ジャッジ時間 12,750 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
6,676 KB
testcase_01 AC 9 ms
6,676 KB
testcase_02 AC 10 ms
6,676 KB
testcase_03 AC 156 ms
6,676 KB
testcase_04 AC 263 ms
6,676 KB
testcase_05 AC 38 ms
6,676 KB
testcase_06 AC 370 ms
6,676 KB
testcase_07 AC 44 ms
6,676 KB
testcase_08 AC 39 ms
6,676 KB
testcase_09 AC 248 ms
6,676 KB
testcase_10 AC 133 ms
6,676 KB
testcase_11 AC 317 ms
6,676 KB
testcase_12 AC 156 ms
6,676 KB
testcase_13 AC 230 ms
6,676 KB
testcase_14 AC 194 ms
6,676 KB
testcase_15 AC 215 ms
6,676 KB
testcase_16 AC 32 ms
6,676 KB
testcase_17 AC 336 ms
6,676 KB
testcase_18 AC 374 ms
6,676 KB
testcase_19 AC 373 ms
6,676 KB
testcase_20 AC 373 ms
6,676 KB
testcase_21 AC 371 ms
6,676 KB
testcase_22 AC 373 ms
6,676 KB
testcase_23 AC 373 ms
6,676 KB
testcase_24 AC 372 ms
6,676 KB
testcase_25 AC 374 ms
6,676 KB
testcase_26 AC 374 ms
6,676 KB
testcase_27 AC 373 ms
6,676 KB
testcase_28 AC 376 ms
6,676 KB
testcase_29 AC 371 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;

#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, x, n) for (int i = (x); i < n; ++i)
#define rrep(i, n) for (int i = n - 1; i >= 0; --i)
#define RREP(i, x, n) for (int i = n - 1; i >= (x); --i)
#define all(x) x.begin(), x.end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using mint = modint998244353;
using vm = vector<mint>;
using vvm = vector<vm>;
using vvvm = vector<vvm>;

const int INF = 1e9;

// int pow(ll a, int n, int m)
// {
//     ll ans = 1;
//     a %= m;

//     while (n)
//     {
//         if (n & 1)
//             ans = ans * a % m;
//         a = a * a % m;
//         n >>= 1;
//     }
//     return (int)ans;
// }

// struct combination
// {
//     vm fact, ifact;
//     combination(int n) : fact(n + 1), ifact(n + 1)
//     {
//         fact[0] = 1;
//         for (int i = 1; i <= n; ++i)
//             fact[i] = fact[i - 1] * i;
//         ifact[n] = fact[n].inv();
//         for (int i = n; i >= 1; --i)
//             ifact[i - 1] = ifact[i] * i;
//     }
//     mint operator()(int n, int k)
//     {
//         if (k < 0 || k > n)
//             return 0;
//         return fact[n] * ifact[k] * ifact[n - k];
//     }
// } comb(5000005);

int main()
{
    int n;
    cin >> n;
    bitset<4000005> dp(1);
    rep(i, n)
    {
        int a;
        cin >> a;
        dp ^= (dp << a);
    }
    int ans = 0;
    rep(i, 4000001)
    {
        if (dp[i])
            ans ^= i;
    }
    cout << ans << endl;

    return 0;
}
0