結果

問題 No.1689 Set Cards
ユーザー titiatitia
提出日時 2021-09-24 23:23:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 823 ms / 2,000 ms
コード長 375 bytes
コンパイル時間 459 ms
コンパイル使用メモリ 10,992 KB
実行使用メモリ 8,380 KB
最終ジャッジ日時 2023-09-18 22:23:56
合計ジャッジ時間 12,017 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
7,732 KB
testcase_01 AC 22 ms
7,884 KB
testcase_02 AC 66 ms
7,960 KB
testcase_03 AC 41 ms
7,756 KB
testcase_04 AC 40 ms
7,800 KB
testcase_05 AC 45 ms
7,948 KB
testcase_06 AC 42 ms
7,868 KB
testcase_07 AC 29 ms
7,876 KB
testcase_08 AC 17 ms
7,756 KB
testcase_09 AC 17 ms
7,808 KB
testcase_10 AC 32 ms
7,800 KB
testcase_11 AC 768 ms
8,312 KB
testcase_12 AC 765 ms
8,244 KB
testcase_13 AC 733 ms
7,812 KB
testcase_14 AC 771 ms
7,796 KB
testcase_15 AC 218 ms
7,944 KB
testcase_16 AC 521 ms
7,800 KB
testcase_17 AC 137 ms
7,800 KB
testcase_18 AC 758 ms
8,368 KB
testcase_19 AC 689 ms
8,304 KB
testcase_20 AC 664 ms
8,192 KB
testcase_21 AC 724 ms
7,868 KB
testcase_22 AC 713 ms
7,804 KB
testcase_23 AC 751 ms
7,948 KB
testcase_24 AC 823 ms
8,200 KB
testcase_25 AC 781 ms
8,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N=int(input())

mod=998244353

S=[list(map(int,input().split()))[1:] for i in range(N)]

DP=[0]*(1<<12)
DP[0]=1

for i in range(N):
    s=S[i]
    ax=0
    for j in range(12):
        if j+1 in s:
            continue
        ax+=(1<<j)

    for k in range((1<<12)-1,-1,-1):
        DP[ax|k]+=DP[k]
        DP[ax|k]%=mod

print(DP[-1])
0