結果
| 問題 | No.2672 Subset Xor Sum |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-16 18:25:10 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 20 ms / 2,000 ms |
| コード長 | 655 bytes |
| 記録 | |
| コンパイル時間 | 505 ms |
| コンパイル使用メモリ | 91,008 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2026-07-04 03:07:26 |
| 合計ジャッジ時間 | 2,425 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 66 |
ソースコード
#include <iostream>
#include <vector>
bool solve(const int n, const std::vector<int> &a) {
int x = 0;
for (int e : a) x ^= e;
if (x) return false;
std::vector<int> b;
for (int i = 0; i < n; ++i) {
int e = a[i];
for (int v : b) e = std::min(e, e ^ v);
if (e) {
b.push_back(e);
continue;
}
return i != n - 1;
}
return false;
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n;
std::cin >> n;
std::vector<int> a(n);
for (auto &e : a) std::cin >> e;
std::cout << (solve(n, a) ? "Yes" : "No") << std::endl;
}