結果
| 問題 |
No.2672 Subset Xor Sum
|
| コンテスト | |
| ユーザー |
Today03
|
| 提出日時 | 2024-03-16 11:22:31 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,164 bytes |
| コンパイル時間 | 1,882 ms |
| コンパイル使用メモリ | 194,712 KB |
| 最終ジャッジ日時 | 2025-02-20 06:45:53 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | AC * 16 WA * 29 OLE * 1 -- * 20 |
ソースコード
#include <bits/stdc++.h>
#ifdef LOCAL
#include "./debug.cpp"
#else
#define debug(...)
#define print_line
#endif
using namespace std;
using ll = long long;
int N, A[5 << 17];
bool dp[2][1 << 13][2];
int main() {
cin >> N;
for (int i = 0; i < N; i++) {
cin >> A[i];
}
int xors = 0;
for (int i = 0; i < N; i++) {
xors ^= A[i];
}
if (xors != 0) {
cout << "No" << endl;
return 0;
}
if (N > 5000) {
cout << "Yes" << endl;
return 0;
}
int mx = 1 << 13;
dp[0][A[0]][1] = true;
for (int i = 0; i < N - 1; i++) {
for (int j = 0; j < mx; j++) {
for (int k = 0; k < 2; k++) {
if (dp[i % 2][j][k]) {
cout << i << ' ' << j << ' ' << k << endl;
dp[1 - i % 2][j][0] = true;
dp[1 - i % 2][j ^ A[i + 1]][k] = true;
}
}
}
for (int j = 0; j < mx; j++) {
dp[i % 2][j][0] = dp[i % 2][j][1] = false;
}
}
if (dp[1 - N % 2][0][0]) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
}
Today03