結果

問題 No.1689 Set Cards
ユーザー 👑 rin204rin204
提出日時 2022-01-25 17:12:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 352 ms / 2,000 ms
コード長 412 bytes
コンパイル時間 333 ms
コンパイル使用メモリ 87,156 KB
実行使用メモリ 84,700 KB
最終ジャッジ日時 2023-08-22 12:06:23
合計ジャッジ時間 5,037 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,500 KB
testcase_01 AC 71 ms
71,568 KB
testcase_02 AC 72 ms
71,244 KB
testcase_03 AC 79 ms
76,380 KB
testcase_04 AC 76 ms
76,432 KB
testcase_05 AC 73 ms
71,436 KB
testcase_06 AC 72 ms
71,232 KB
testcase_07 AC 71 ms
71,428 KB
testcase_08 AC 70 ms
71,464 KB
testcase_09 AC 70 ms
71,456 KB
testcase_10 AC 72 ms
71,308 KB
testcase_11 AC 229 ms
79,868 KB
testcase_12 AC 226 ms
79,876 KB
testcase_13 AC 101 ms
76,588 KB
testcase_14 AC 125 ms
77,504 KB
testcase_15 AC 106 ms
77,400 KB
testcase_16 AC 132 ms
77,300 KB
testcase_17 AC 93 ms
76,940 KB
testcase_18 AC 243 ms
80,068 KB
testcase_19 AC 86 ms
76,684 KB
testcase_20 AC 86 ms
76,864 KB
testcase_21 AC 82 ms
75,704 KB
testcase_22 AC 82 ms
75,668 KB
testcase_23 AC 92 ms
76,676 KB
testcase_24 AC 352 ms
84,700 KB
testcase_25 AC 161 ms
78,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353

n = int(input())
lst = []
for _ in range(n):
    k, *C = map(int, input().split())
    bit = 0
    for c in C:
        bit |= 1 << (c - 1)
    lst.append(bit)
dp = {(1 << 12) - 1:1}
for c in lst:
    dp2 = {}
    for k, v in dp.items():
        dp2[k] = dp2.get(k, 0) + v
        dp2[k] %= MOD
        dp2[k & c] = dp2.get(k & c, 0) + v
        dp2[k & c] %= MOD
    dp = dp2
print(dp.get(0, 0))
0