結果

問題 No.1689 Set Cards
ユーザー rlangevinrlangevin
提出日時 2023-02-14 23:21:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 126 ms / 2,000 ms
コード長 437 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 86,860 KB
実行使用メモリ 77,676 KB
最終ジャッジ日時 2023-09-24 10:14:01
合計ジャッジ時間 4,237 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
76,092 KB
testcase_01 AC 83 ms
75,936 KB
testcase_02 AC 85 ms
76,028 KB
testcase_03 AC 83 ms
76,124 KB
testcase_04 AC 83 ms
76,076 KB
testcase_05 AC 83 ms
75,936 KB
testcase_06 AC 85 ms
76,092 KB
testcase_07 AC 83 ms
75,984 KB
testcase_08 AC 78 ms
76,052 KB
testcase_09 AC 79 ms
76,080 KB
testcase_10 AC 83 ms
75,904 KB
testcase_11 AC 126 ms
77,504 KB
testcase_12 AC 121 ms
77,624 KB
testcase_13 AC 122 ms
77,676 KB
testcase_14 AC 119 ms
77,624 KB
testcase_15 AC 89 ms
75,840 KB
testcase_16 AC 115 ms
77,616 KB
testcase_17 AC 89 ms
76,160 KB
testcase_18 AC 121 ms
77,656 KB
testcase_19 AC 120 ms
77,548 KB
testcase_20 AC 121 ms
77,428 KB
testcase_21 AC 113 ms
76,868 KB
testcase_22 AC 113 ms
77,252 KB
testcase_23 AC 114 ms
77,156 KB
testcase_24 AC 119 ms
77,620 KB
testcase_25 AC 121 ms
77,644 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
mod = 998244353
N2 = 1 << 12
D = []
for i in range(N):
    C = list(map(int, input().split()))
    v = 0
    for j in range(1, C[0] + 1):
        v |= 1 << (C[j] - 1)
    D.append(v)

pre = [0] * N2
pre[-1] = 1
for i in range(N):
    dp = [0] * N2
    for s in range(N2):
        dp[s & D[i]] += pre[s]
        dp[s] += pre[s]
        dp[s] %= mod
        dp[s & D[i]] %= mod
    pre, dp = dp, pre

print(pre[0])        
0