結果

問題 No.1689 Set Cards
ユーザー aaaaaaaaaa2230
提出日時 2021-09-24 22:21:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 358 bytes
コンパイル時間 218 ms
コンパイル使用メモリ 82,188 KB
実行使用メモリ 68,864 KB
最終ジャッジ日時 2024-07-05 10:50:55
合計ジャッジ時間 2,331 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

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