結果

問題 No.1689 Set Cards
ユーザー mymelochanmymelochan
提出日時 2021-09-25 00:46:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 118 ms / 2,000 ms
コード長 357 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 86,976 KB
実行使用メモリ 77,864 KB
最終ジャッジ日時 2023-09-18 22:33:52
合計ジャッジ時間 4,003 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
76,076 KB
testcase_01 AC 84 ms
75,976 KB
testcase_02 AC 86 ms
76,140 KB
testcase_03 AC 85 ms
76,232 KB
testcase_04 AC 84 ms
76,040 KB
testcase_05 AC 84 ms
75,940 KB
testcase_06 AC 83 ms
76,188 KB
testcase_07 AC 82 ms
76,040 KB
testcase_08 AC 80 ms
75,880 KB
testcase_09 AC 80 ms
76,068 KB
testcase_10 AC 85 ms
76,044 KB
testcase_11 AC 114 ms
77,864 KB
testcase_12 AC 115 ms
77,708 KB
testcase_13 AC 118 ms
77,596 KB
testcase_14 AC 116 ms
77,456 KB
testcase_15 AC 90 ms
75,996 KB
testcase_16 AC 111 ms
77,636 KB
testcase_17 AC 89 ms
76,220 KB
testcase_18 AC 116 ms
77,532 KB
testcase_19 AC 116 ms
77,456 KB
testcase_20 AC 113 ms
77,612 KB
testcase_21 AC 106 ms
77,244 KB
testcase_22 AC 109 ms
77,224 KB
testcase_23 AC 110 ms
77,108 KB
testcase_24 AC 115 ms
77,612 KB
testcase_25 AC 114 ms
77,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
MOD = 998244353
B = []
for _ in range(N):
    L = list(map(int,input().split()))
    C = L[1:]
    b = 0
    for c in C:
        b += 1<<(c-1)
    B.append(b)

dp = [0]*(1<<12)
dp[-1] = 1
for b in B:
    ndp = dp.copy()
    for bit in range(1<<12):
        a = bit&b
        ndp[a] += dp[bit]
        ndp[a] %= MOD
    dp = ndp
print(dp[0])
0