結果

問題 No.1689 Set Cards
ユーザー brthyyjpbrthyyjp
提出日時 2021-09-24 22:46:30
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 789 bytes
コンパイル時間 253 ms
コンパイル使用メモリ 86,780 KB
実行使用メモリ 327,516 KB
最終ジャッジ日時 2023-09-18 21:53:36
合計ジャッジ時間 5,376 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
80,816 KB
testcase_01 AC 91 ms
76,300 KB
testcase_02 AC 228 ms
82,556 KB
testcase_03 AC 134 ms
79,088 KB
testcase_04 AC 138 ms
79,216 KB
testcase_05 AC 136 ms
79,036 KB
testcase_06 AC 138 ms
79,436 KB
testcase_07 AC 100 ms
76,376 KB
testcase_08 AC 79 ms
76,100 KB
testcase_09 AC 80 ms
76,168 KB
testcase_10 AC 109 ms
76,956 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
C = []
for i in range(n):
    temp = list(map(int, input().split()))
    temp = temp[1:]
    if temp:
        temp = [i-1 for i in temp]
    C.append(temp)
#print(C)
mod = 998244353
dp = [[0]*(1<<12) for i in range(n+1)]
dp[0][0] = 1
for i in range(n):
    nx = [[0]*(1<<12) for i in range(n+1)]
    for j in range(n+1):
        for s in range(1<<12):
            nx[j][s] = dp[j][s]
    v = 0
    for c in C[i]:
        v |= (1<<c)
    for j in range(n):
        for s in range(1<<12):
            if j == 0:
                nx[j+1][s|v] += dp[j][s]
                nx[j+1][s|v] %= mod
            else:
                nx[j+1][s&v] += dp[j][s]
                nx[j+1][s&v] %= mod
    dp = nx
ans = 0
for j in range(1, n+1):
    ans += dp[j][0]
    ans %= mod
print(ans)
0