結果

問題 No.1689 Set Cards
ユーザー chineristACchineristAC
提出日時 2021-09-24 21:53:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 158 ms / 2,000 ms
コード長 470 bytes
コンパイル時間 1,587 ms
コンパイル使用メモリ 86,596 KB
実行使用メモリ 78,476 KB
最終ジャッジ日時 2023-09-18 21:14:36
合計ジャッジ時間 4,432 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
77,392 KB
testcase_01 AC 101 ms
77,708 KB
testcase_02 AC 102 ms
77,464 KB
testcase_03 AC 101 ms
77,172 KB
testcase_04 AC 101 ms
77,376 KB
testcase_05 AC 105 ms
77,600 KB
testcase_06 AC 103 ms
77,352 KB
testcase_07 AC 100 ms
77,352 KB
testcase_08 AC 96 ms
76,552 KB
testcase_09 AC 96 ms
76,516 KB
testcase_10 AC 102 ms
77,224 KB
testcase_11 AC 158 ms
78,436 KB
testcase_12 AC 130 ms
78,244 KB
testcase_13 AC 134 ms
78,428 KB
testcase_14 AC 131 ms
78,444 KB
testcase_15 AC 108 ms
77,380 KB
testcase_16 AC 121 ms
78,072 KB
testcase_17 AC 105 ms
77,372 KB
testcase_18 AC 134 ms
78,204 KB
testcase_19 AC 129 ms
78,260 KB
testcase_20 AC 129 ms
78,144 KB
testcase_21 AC 119 ms
78,300 KB
testcase_22 AC 123 ms
78,160 KB
testcase_23 AC 124 ms
78,004 KB
testcase_24 AC 127 ms
78,476 KB
testcase_25 AC 128 ms
78,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,random

input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

mod = 998244353

N = int(input())

dp = [0 for i in range(4096)]
dp[4095] = 1

for i in range(N):
    k,*C = li()
    tmp = 0
    for c in C:
        tmp += pow(2,c-1)
    assert len(C)==k
    
    ndp = [dp[j] for j in range(4096)]
    for j in range(4096):
        ndp[j&tmp] += dp[j]
        ndp[j] %= mod
    dp = ndp

print(dp[0] % mod)
0