結果

問題 No.1689 Set Cards
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-09-24 22:21:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 112 ms / 2,000 ms
コード長 358 bytes
コンパイル時間 380 ms
コンパイル使用メモリ 87,240 KB
実行使用メモリ 77,212 KB
最終ジャッジ日時 2023-09-18 21:39:27
合計ジャッジ時間 3,943 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
76,084 KB
testcase_01 AC 80 ms
76,092 KB
testcase_02 AC 80 ms
76,396 KB
testcase_03 AC 81 ms
76,000 KB
testcase_04 AC 80 ms
76,300 KB
testcase_05 AC 79 ms
76,196 KB
testcase_06 AC 80 ms
76,308 KB
testcase_07 AC 81 ms
76,120 KB
testcase_08 AC 77 ms
76,232 KB
testcase_09 AC 78 ms
76,100 KB
testcase_10 AC 81 ms
76,248 KB
testcase_11 AC 111 ms
77,128 KB
testcase_12 AC 112 ms
77,004 KB
testcase_13 AC 105 ms
77,020 KB
testcase_14 AC 108 ms
77,212 KB
testcase_15 AC 84 ms
76,128 KB
testcase_16 AC 98 ms
76,992 KB
testcase_17 AC 82 ms
76,188 KB
testcase_18 AC 102 ms
77,128 KB
testcase_19 AC 102 ms
77,036 KB
testcase_20 AC 104 ms
76,988 KB
testcase_21 AC 99 ms
76,912 KB
testcase_22 AC 102 ms
76,836 KB
testcase_23 AC 103 ms
77,104 KB
testcase_24 AC 104 ms
77,100 KB
testcase_25 AC 102 ms
77,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
mod = 998244353
dp = [0]*(1<<12)
for i in range(n):
    L = list(map(int,input().split()))
    count = 0
    for c in L[1:]:
        count |= 1<<(c-1)
    for j in range(1<<12):
        dp[j&count] += dp[j]
        dp[j&count] %= mod
    dp[count] += 1
ans = pow(2,n,mod)-1
for i in range(1,1<<12):
    ans -= dp[i]
    ans %= mod
print(ans)
0