結果

問題 No.2134 $\sigma$-algebra over Finite Set
ユーザー titiatitia
提出日時 2022-12-11 00:58:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 598 bytes
コンパイル時間 197 ms
コンパイル使用メモリ 82,356 KB
実行使用メモリ 77,196 KB
最終ジャッジ日時 2024-04-23 01:49:33
合計ジャッジ時間 2,960 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 52 ms
76,384 KB
testcase_07 AC 53 ms
75,752 KB
testcase_08 AC 32 ms
52,496 KB
testcase_09 AC 32 ms
52,064 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 164 ms
76,280 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 33 ms
52,272 KB
testcase_18 AC 32 ms
53,016 KB
権限があれば一括ダウンロードができます

ソースコード

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