結果

問題 No.1689 Set Cards
ユーザー 👑 H20H20
提出日時 2021-09-24 22:17:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 139 ms / 2,000 ms
コード長 389 bytes
コンパイル時間 458 ms
コンパイル使用メモリ 87,184 KB
実行使用メモリ 78,816 KB
最終ジャッジ日時 2023-09-18 21:35:05
合計ジャッジ時間 4,386 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
71,628 KB
testcase_01 AC 87 ms
71,728 KB
testcase_02 AC 88 ms
71,816 KB
testcase_03 AC 92 ms
76,288 KB
testcase_04 AC 92 ms
76,396 KB
testcase_05 AC 92 ms
76,412 KB
testcase_06 AC 90 ms
76,300 KB
testcase_07 AC 90 ms
76,032 KB
testcase_08 AC 85 ms
71,816 KB
testcase_09 AC 88 ms
75,952 KB
testcase_10 AC 90 ms
76,144 KB
testcase_11 AC 131 ms
78,620 KB
testcase_12 AC 130 ms
78,816 KB
testcase_13 AC 118 ms
78,704 KB
testcase_14 AC 117 ms
78,356 KB
testcase_15 AC 102 ms
76,856 KB
testcase_16 AC 118 ms
78,764 KB
testcase_17 AC 99 ms
77,160 KB
testcase_18 AC 132 ms
78,584 KB
testcase_19 AC 122 ms
78,444 KB
testcase_20 AC 120 ms
78,524 KB
testcase_21 AC 97 ms
71,664 KB
testcase_22 AC 102 ms
76,828 KB
testcase_23 AC 112 ms
77,520 KB
testcase_24 AC 139 ms
78,792 KB
testcase_25 AC 123 ms
78,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import copy
N = int(input())
L = []
mod = 998244353
for _ in range(N):
    A = list(map(int, input().split()))
    temp = 0
    for i in range(1,A[0]+1):
        temp+=2**(A[i]-1)
    L.append(temp)
DP = [0]*(max(L)+1)
for l in L:
    NDP = copy.copy(DP)
    for i in range(len(DP)):
        if DP[i]>0:
            NDP[i&l]=(NDP[i&l]+DP[i])%mod
    NDP[l]+=1
    DP = NDP
print(DP[0]%mod)
0