結果
問題 | No.1689 Set Cards |
ユーザー |
![]() |
提出日時 | 2021-09-24 22:18:41 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 9 ms / 2,000 ms |
コード長 | 630 bytes |
コンパイル時間 | 2,598 ms |
コンパイル使用メモリ | 193,164 KB |
最終ジャッジ日時 | 2025-01-24 17:25:19 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/modint> using mint = atcoder::modint998244353; using namespace std; using ll = long long; mint dp[1 << 12]; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; dp[(1 << 12) - 1] = 1; for (int i = 0; i < n; i++) { int k; cin >> k; int t = 0; for (int j = 0; j < k; j++) { int c; cin >> c; c--; t ^= 1 << c; } for (int k = 0; k < 1 << 12; k++) { dp[k & t] += dp[k]; } } cout << dp[0].val() << endl; return 0; }