結果

問題 No.1689 Set Cards
ユーザー kohei2019kohei2019
提出日時 2023-06-07 00:12:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 404 bytes
コンパイル時間 140 ms
コンパイル使用メモリ 82,384 KB
実行使用メモリ 77,568 KB
最終ジャッジ日時 2024-06-09 06:22:35
合計ジャッジ時間 2,604 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
61,696 KB
testcase_01 AC 46 ms
61,440 KB
testcase_02 AC 45 ms
62,464 KB
testcase_03 AC 45 ms
61,696 KB
testcase_04 AC 42 ms
61,952 KB
testcase_05 AC 44 ms
62,976 KB
testcase_06 AC 43 ms
61,952 KB
testcase_07 AC 42 ms
61,568 KB
testcase_08 AC 40 ms
59,904 KB
testcase_09 AC 40 ms
60,160 KB
testcase_10 AC 42 ms
61,824 KB
testcase_11 AC 79 ms
77,184 KB
testcase_12 AC 83 ms
77,032 KB
testcase_13 AC 78 ms
77,184 KB
testcase_14 AC 81 ms
76,800 KB
testcase_15 AC 50 ms
66,816 KB
testcase_16 AC 73 ms
76,544 KB
testcase_17 AC 47 ms
64,896 KB
testcase_18 AC 80 ms
77,568 KB
testcase_19 AC 81 ms
76,916 KB
testcase_20 AC 79 ms
76,968 KB
testcase_21 AC 75 ms
77,056 KB
testcase_22 AC 74 ms
77,056 KB
testcase_23 AC 75 ms
76,672 KB
testcase_24 AC 81 ms
76,672 KB
testcase_25 AC 79 ms
77,056 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