結果

問題 No.1876 Xor of Sum
ユーザー 00 0000 00
提出日時 2022-05-03 17:32:15
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 373 ms / 2,000 ms
コード長 344 bytes
コンパイル時間 4,520 ms
コンパイル使用メモリ 243,520 KB
実行使用メモリ 4,988 KB
最終ジャッジ日時 2023-09-15 10:35:57
合計ジャッジ時間 11,509 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
4,908 KB
testcase_01 AC 8 ms
4,808 KB
testcase_02 AC 9 ms
4,852 KB
testcase_03 AC 154 ms
4,824 KB
testcase_04 AC 261 ms
4,864 KB
testcase_05 AC 38 ms
4,792 KB
testcase_06 AC 370 ms
4,876 KB
testcase_07 AC 43 ms
4,852 KB
testcase_08 AC 38 ms
4,796 KB
testcase_09 AC 244 ms
4,988 KB
testcase_10 AC 132 ms
4,984 KB
testcase_11 AC 308 ms
4,852 KB
testcase_12 AC 153 ms
4,808 KB
testcase_13 AC 225 ms
4,824 KB
testcase_14 AC 190 ms
4,784 KB
testcase_15 AC 210 ms
4,872 KB
testcase_16 AC 31 ms
4,852 KB
testcase_17 AC 332 ms
4,864 KB
testcase_18 AC 370 ms
4,796 KB
testcase_19 AC 369 ms
4,856 KB
testcase_20 AC 370 ms
4,840 KB
testcase_21 AC 371 ms
4,804 KB
testcase_22 AC 371 ms
4,788 KB
testcase_23 AC 373 ms
4,876 KB
testcase_24 AC 367 ms
4,812 KB
testcase_25 AC 367 ms
4,972 KB
testcase_26 AC 369 ms
4,908 KB
testcase_27 AC 367 ms
4,796 KB
testcase_28 AC 370 ms
4,804 KB
testcase_29 AC 370 ms
4,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
const int mxN = 4e6 +5;
int main(){
    int n;
    cin >> n;
    bitset <mxN> dp;
    dp[0] = 1;
    for(int i = 0, a;i < n;i++){
        cin >> a;
        dp ^= (dp << a);
    }

    int ans = 0;
    for(int i = 0;i < mxN;i++)
        if(dp[i]) ans ^= i;

    cout << ans << "\n";

    return 0;
}
0