結果

問題 No.2672 Subset Xor Sum
ユーザー SoniSoni
提出日時 2024-03-15 23:31:00
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 900 bytes
コンパイル時間 1,245 ms
コンパイル使用メモリ 100,164 KB
実行使用メモリ 16,252 KB
最終ジャッジ日時 2024-03-15 23:31:08
合計ジャッジ時間 7,497 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 WA -
testcase_02 AC 3 ms
6,676 KB
testcase_03 AC 3 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 3 ms
6,676 KB
testcase_12 AC 3 ms
6,676 KB
testcase_13 AC 3 ms
6,676 KB
testcase_14 AC 4 ms
6,676 KB
testcase_15 AC 3 ms
6,676 KB
testcase_16 AC 4 ms
6,676 KB
testcase_17 AC 3 ms
6,676 KB
testcase_18 AC 3 ms
6,676 KB
testcase_19 AC 3 ms
6,676 KB
testcase_20 AC 3 ms
6,676 KB
testcase_21 AC 2 ms
6,676 KB
testcase_22 AC 2 ms
6,676 KB
testcase_23 AC 2 ms
6,676 KB
testcase_24 AC 2 ms
6,676 KB
testcase_25 AC 30 ms
6,676 KB
testcase_26 AC 29 ms
6,676 KB
testcase_27 AC 6 ms
6,676 KB
testcase_28 AC 6 ms
6,676 KB
testcase_29 WA -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 TLE -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
testcase_62 -- -
testcase_63 -- -
testcase_64 -- -
testcase_65 -- -
testcase_66 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>

using namespace std;

int I() {
    int x;
    cin >> x;
    return x;
}

vector<int> LI() {
    int n = I();
    vector<int> vec(n);
    for (int i = 0; i < n; ++i) {
        cin >> vec[i];
    }
    return vec;
}

int main() {
    int n = I();
    vector<int> a = LI();
    
    unordered_map<int, int> a_cnt;
    for (int i = 0; i < n; ++i) {
        a_cnt[a[i]]++;
    }

    unordered_map<int, long long> dp;
    dp[0] = 1;
    for (auto &[num, count] : a_cnt) {
        unordered_map<int, long long> ndp;
        int mul = 1 << (count - 1);
        for (auto &[val, cnt] : dp) {
            ndp[val] += cnt * mul;
            ndp[val ^ num] += cnt * mul;
        }
        dp = ndp;
    }

    if (dp[0] == 2) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }

    return 0;
}
0