結果
問題 | No.2672 Subset Xor Sum |
ユーザー |
|
提出日時 | 2024-08-06 11:35:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 139 ms / 2,000 ms |
コード長 | 662 bytes |
コンパイル時間 | 1,856 ms |
コンパイル使用メモリ | 170,128 KB |
実行使用メモリ | 7,172 KB |
最終ジャッジ日時 | 2024-08-06 11:35:30 |
合計ジャッジ時間 | 5,424 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 66 |
ソースコード
#include<bits/stdc++.h> using namespace std; const int64_t inf = 1e18; const int64_t mod = 998244353; // const int64_t mod = 1000000007; int main() { int n; cin >> n; vector<long long> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } vector<long long> b; for (int i = 0; i < n; i++) { long long y = a[i]; for (auto x: b) { y = min(y, y ^ x); } if (y > 0) b.push_back(y); } long long allxor = 0; for (int i = 0; i < n; i++) { allxor ^= a[i]; } int m = b.size(); if (n - m < 2 || allxor != 0) cout << "No" << endl; else cout << "Yes" << endl; }