結果

問題 No.2134 $\sigma$-algebra over Finite Set
ユーザー titia
提出日時 2022-12-11 00:58:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 598 bytes
コンパイル時間 1,383 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 76,416 KB
最終ジャッジ日時 2024-10-15 01:05:41
合計ジャッジ時間 4,888 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N,M=map(int,input().split())
mod=998244353

BASE=[]

def sweep(x):
    for b in BASE:
        if b^x<x:
            x=b^x
    return x

ALL=(1<<N)-1

for i in range(M):
    A=list(map(int,input().split()))

    x=0
    for a in A[1:]:
        x|=1<<a

    k=sweep(x)
    if k!=0: # 掃き出した値が0でないなら基底に入れる。
        BASE.append(k)

    x=ALL^x

    k=sweep(x)
    if k!=0: # 掃き出した値が0でないなら基底に入れる。
        BASE.append(k)

if len(BASE)==0:
    print(2)
else:
    print(pow(2,len(BASE),mod))
0