結果
問題 |
No.2672 Subset Xor Sum
|
ユーザー |
|
提出日時 | 2024-03-16 00:10:58 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 38 ms / 2,000 ms |
コード長 | 677 bytes |
コンパイル時間 | 2,438 ms |
コンパイル使用メモリ | 247,128 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-09-30 04:25:47 |
合計ジャッジ時間 | 4,594 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 66 |
ソースコード
#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; return 0; } int M = 14; 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; }