結果

問題 No.2672 Subset Xor Sum
ユーザー aaaaaaaaaa2230
提出日時 2024-03-15 23:21:45
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 659 bytes
コンパイル時間 2,490 ms
コンパイル使用メモリ 246,556 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-09-30 02:55:51
合計ジャッジ時間 4,641 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 52 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

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


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;
    vector<int> A(n);
    for (auto &a: A) cin >> a;
    int x = 0;
    for (auto a: A) x^= a;

    if (x){
        cout << "No" << endl;
    }

    int M = 16;

    if (n > M){
        cout << "Yes" << endl;
        return 0;
    }

    for (int i = 1; i < (1<<n)-1; i++){
        int x = 0;
        for (int j = 0; j < n; j++){
            if (i >> j & 1) x ^= A[j];
        }
        if (x == 0) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
    return 0;
}
0