結果

問題 No.2672 Subset Xor Sum
ユーザー aaaaaaaaaa2230
提出日時 2024-03-15 23:19:48
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 641 bytes
コンパイル時間 3,043 ms
コンパイル使用メモリ 245,604 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2024-09-30 02:53:39
合計ジャッジ時間 8,204 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 27 WA * 6 TLE * 1 -- * 32
権限があれば一括ダウンロードができます

ソースコード

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;
    }

    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