結果

問題 No.1689 Set Cards
ユーザー tassei903tassei903
提出日時 2021-09-24 22:32:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 114 ms / 2,000 ms
コード長 716 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 86,872 KB
実行使用メモリ 77,576 KB
最終ジャッジ日時 2023-09-18 21:47:23
合計ジャッジ時間 3,864 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
76,184 KB
testcase_01 AC 81 ms
76,104 KB
testcase_02 AC 80 ms
76,148 KB
testcase_03 AC 80 ms
76,080 KB
testcase_04 AC 81 ms
76,080 KB
testcase_05 AC 84 ms
76,116 KB
testcase_06 AC 80 ms
76,172 KB
testcase_07 AC 80 ms
76,040 KB
testcase_08 AC 78 ms
76,296 KB
testcase_09 AC 78 ms
76,240 KB
testcase_10 AC 82 ms
76,116 KB
testcase_11 AC 112 ms
77,576 KB
testcase_12 AC 114 ms
77,392 KB
testcase_13 AC 113 ms
77,380 KB
testcase_14 AC 114 ms
77,500 KB
testcase_15 AC 87 ms
76,140 KB
testcase_16 AC 101 ms
77,392 KB
testcase_17 AC 84 ms
76,256 KB
testcase_18 AC 112 ms
77,480 KB
testcase_19 AC 110 ms
77,500 KB
testcase_20 AC 110 ms
77,368 KB
testcase_21 AC 101 ms
77,332 KB
testcase_22 AC 104 ms
77,436 KB
testcase_23 AC 105 ms
77,424 KB
testcase_24 AC 109 ms
77,512 KB
testcase_25 AC 109 ms
77,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
sys.setrecursionlimit(10**7)
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################
n = ni()
m = 12
dp = [0]*(1<<m)
dp[-1] = 1
mod = 998244353
for i in range(n):
    p = [0]*(1<<m)
    dp,p = p,dp
    c = 0
    q = na()
    k = q[0]
    for j in range(k):
        c+=1<<(q[j+1]-1)
    for j in range(1<<m):
        dp[j]+=p[j]
        dp[j]%=mod
        nj = j&c
        dp[nj]+=p[j]
        dp[nj]%=mod

print(dp[0])
0