結果

問題 No.1689 Set Cards
ユーザー ぷらぷら
提出日時 2021-09-24 21:51:05
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 729 bytes
コンパイル時間 2,262 ms
コンパイル使用メモリ 205,092 KB
実行使用メモリ 19,404 KB
最終ジャッジ日時 2023-09-18 21:12:29
合計ジャッジ時間 3,584 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 3 ms
4,380 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2 ms
4,384 KB
testcase_07 WA -
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 22 ms
19,252 KB
testcase_14 AC 22 ms
19,400 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 24 ms
19,160 KB
testcase_20 AC 24 ms
19,112 KB
testcase_21 AC 25 ms
19,212 KB
testcase_22 AC 24 ms
19,108 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

constexpr int mod = 998244353;

int main() {
    int N;
    cin >> N;
    vector<int>C(N);
    for(int i = 0; i < N; i++) {
        int k;
        cin >> k;
        int sum = 0;
        for(int j = 0; j < k; j++) {
            int a;
            cin >> a;
            sum += 1 << a;
        }
        C[i] = sum;
    }
    vector<vector<long long>>dp(N+1,vector<long long>(1 << 12));
    dp[0][(1 << 12)-1] = 1;
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < (1 << 12); j++) {
            dp[i+1][j] += dp[i][j];
            dp[i+1][j] %= mod;
            dp[i+1][j&C[i]] += dp[i][j];
            dp[i+1][j&C[i]] %= mod;
        }
    }
    cout << dp[N][0] << endl;
}
0