結果

問題 No.1689 Set Cards
ユーザー hitonanode
提出日時 2021-09-24 22:27:33
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 560 bytes
コンパイル時間 587 ms
コンパイル使用メモリ 81,540 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-05 10:55:16
合計ジャッジ時間 1,304 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <atcoder/modint>
using namespace std;
using mint = atcoder::modint998244353;

constexpr int D = 12;
mint dp[1 << 12];

int main() {
    cin.tie(nullptr), ios::sync_with_stdio(false);
    int N;
    cin >> N;
    dp[(1 << 12) - 1] = 1;
    while (N--) {
        int k;
        cin >> k;
        int mask = 0;
        while (k--) {
            int c;
            cin >> c;
            c--;
            mask |= 1 << c;
        }
        for (int s = 0; s < 1 << 12; ++s)dp[s & mask] += dp[s];
    }
    cout << dp[0].val() << '\n';
}
0