結果

問題 No.1689 Set Cards
ユーザー ああいい
提出日時 2022-03-04 10:42:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 500 bytes
コンパイル時間 132 ms
コンパイル使用メモリ 82,252 KB
実行使用メモリ 72,576 KB
最終ジャッジ日時 2024-07-18 07:58:15
合計ジャッジ時間 2,377 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

dat = [0] * (1 << 12)
for _ in range(N):
    k,*l = map(int,input().split())
    bit = 0
    for i in l:
        bit |= 1 << (i-1)
    dat[bit] += 1
P = 998244353
for i in range(12):
    for bit in range(1 << 12):
        if bit & (1 << i):
            dat[bit ^ (1 << i)] += dat[bit]
ans = pow(2,N,P)-1
for bit in range(1,1 << 12):
    if bin(bit).count('1') % 2 == 0:
        c = 1
    else:
        c = -1
    tmp = pow(2,dat[bit],P) - 1
    ans = (ans + c * tmp) % P
print(ans)
0