結果

問題 No.1689 Set Cards
ユーザー nebukuro09nebukuro09
提出日時 2021-09-24 22:09:41
言語 D
(dmd 2.107.1)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 690 bytes
コンパイル時間 664 ms
コンパイル使用メモリ 105,060 KB
実行使用メモリ 37,088 KB
最終ジャッジ日時 2023-09-04 14:13:50
合計ジャッジ時間 2,333 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 4 ms
5,144 KB
testcase_03 AC 3 ms
4,896 KB
testcase_04 AC 3 ms
4,380 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 3 ms
4,376 KB
testcase_11 AC 40 ms
36,808 KB
testcase_12 AC 40 ms
37,088 KB
testcase_13 AC 40 ms
36,736 KB
testcase_14 AC 39 ms
36,796 KB
testcase_15 AC 13 ms
13,676 KB
testcase_16 AC 30 ms
27,584 KB
testcase_17 AC 9 ms
10,364 KB
testcase_18 AC 40 ms
36,748 KB
testcase_19 AC 43 ms
37,000 KB
testcase_20 AC 41 ms
36,772 KB
testcase_21 AC 42 ms
36,796 KB
testcase_22 AC 42 ms
36,736 KB
testcase_23 AC 42 ms
36,824 KB
testcase_24 AC 41 ms
37,072 KB
testcase_25 AC 40 ms
36,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;

immutable long MOD = 998244353;

void main() {
    auto N = readln.chomp.to!int;
    auto A = new int[](N);
    foreach (i; 0..N) {
        auto s = readln.split.map!(to!int).array;
        foreach (a; s[1..$]) {
            A[i] |= (1 << a);
        }
    }

    auto dp = new long[][](N+1, 1<<13);
    dp[0][(1<<13)-1] = 1;

    foreach (i; 0..N) foreach (mask; 0..(1<<13)) {
        (dp[i+1][mask & A[i]] += dp[i][mask]) %= MOD;
        (dp[i+1][mask] += dp[i][mask]) %= MOD;
    }

    dp[N][0].writeln;
}
0