結果

問題 No.1689 Set Cards
ユーザー kohei2019kohei2019
提出日時 2023-06-07 00:12:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 145 ms / 2,000 ms
コード長 404 bytes
コンパイル時間 1,693 ms
コンパイル使用メモリ 86,492 KB
実行使用メモリ 78,876 KB
最終ジャッジ日時 2023-08-28 10:52:11
合計ジャッジ時間 4,854 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
77,184 KB
testcase_01 AC 98 ms
76,952 KB
testcase_02 AC 99 ms
76,992 KB
testcase_03 AC 100 ms
76,824 KB
testcase_04 AC 101 ms
77,000 KB
testcase_05 AC 101 ms
77,160 KB
testcase_06 AC 101 ms
77,136 KB
testcase_07 AC 99 ms
77,072 KB
testcase_08 AC 96 ms
76,796 KB
testcase_09 AC 96 ms
76,848 KB
testcase_10 AC 100 ms
76,804 KB
testcase_11 AC 145 ms
78,160 KB
testcase_12 AC 138 ms
78,672 KB
testcase_13 AC 131 ms
78,212 KB
testcase_14 AC 138 ms
78,876 KB
testcase_15 AC 108 ms
77,172 KB
testcase_16 AC 123 ms
77,752 KB
testcase_17 AC 104 ms
77,244 KB
testcase_18 AC 133 ms
78,132 KB
testcase_19 AC 131 ms
77,900 KB
testcase_20 AC 130 ms
77,848 KB
testcase_21 AC 128 ms
77,780 KB
testcase_22 AC 129 ms
78,024 KB
testcase_23 AC 126 ms
78,076 KB
testcase_24 AC 132 ms
78,188 KB
testcase_25 AC 133 ms
78,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
N = int(input())
# bitDP
mod = 998244353
ll = 12
dp = [0]*(2**ll)
dp[-1] = 1
for i in range(N):
    ls = list(map(int,input().split()))
    dp2 = [0]*(2**ll)
    k = ls.pop(0)
    a = 0
    for j in ls:
        a += 2**(j-1)
    for j in range(2**ll-1,-1,-1):
        dp2[j&a] += dp[j]
        dp2[j] += dp[j]
        dp2[j&a] %= mod
        dp2[j] %= mod
    dp = dp2
print(dp[0]%mod)
0