結果
問題 |
No.2152 [Cherry Anniversary 2] 19 Petals of Cherry
|
ユーザー |
![]() |
提出日時 | 2022-12-09 08:43:11 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,097 bytes |
コンパイル時間 | 2,639 ms |
コンパイル使用メモリ | 249,076 KB |
実行使用メモリ | 7,424 KB |
最終ジャッジ日時 | 2024-10-14 18:34:11 |
合計ジャッジ時間 | 10,561 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 26 WA * 23 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/modint> using namespace std; using namespace atcoder; using mint = modint998244353; constexpr int mask = (1 << 19) - 1; constexpr int top = 1 << 19; int main() { vector<int> a(19); for (int i = 0; i < 19; i++) { int l; cin >> l; for (int j = 0; j < l; j++) { int x; cin >> x; x--; a.at(i) ^= 1 << x; } } vector<mint> ans(1 << 20); ans.at(0) = 1; for (int i = 0; i < 19; i++) { for (int j = 0; j < 1 << 20; j++) { if (__builtin_popcount(j & mask) != i) continue; for (int k = 0; k < 19; k++) { if ((a.at(i) >> k & 1) and not(j >> k & 1)) { bool flip = __builtin_popcount(j & mask & ~((1 << k) - 1)) % 2 == 1; int t = flip ? top : 0; ans.at(j ^ (1 << k) ^ t) += ans.at(j); } } } } cout << ans.at(mask).val() << ' ' << ans.at(mask ^ top).val() << endl; return 0; }