結果
| 問題 |
No.2134 $\sigma$-algebra over Finite Set
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-11-25 23:58:01 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,038 bytes |
| コンパイル時間 | 256 ms |
| コンパイル使用メモリ | 82,248 KB |
| 実行使用メモリ | 68,648 KB |
| 最終ジャッジ日時 | 2024-10-02 06:23:35 |
| 合計ジャッジ時間 | 2,605 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 2 WA * 2 RE * 13 |
ソースコード
import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
import pypyjit
pypyjit.set_param('max_unroll_recursion=-1')
from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd
mod = 998244353
n,m = map(int,input().split())
s = set()
a = []
l = []
for i in range(m):
aa = list(map(int,input().split()))
l.append(aa[0])
a.append(set(a[1:]))
p = [-1]*(m+1)
def find(x):
if p[x] < 0:
return x
else:
p[x] = find(p[x])
return p[x]
def union(x,y):
x = find(x)
y = find(y)
if x == y:
return
if p[x] > p[y]:
x,y = y,x
p[x] += p[y]
p[y] = x
un = []
for i in range(1,n+1):
rep = -1
flg = 0
for j in range(m):
if i in a[j] and rep == -1:
rep = j
flg = 1
else:
union(j,rep)
if not flg:
un.append(i)
d = defaultdict(int)
for i in range(1,m+1):
d[find(i)] += 1
ans = pow(2, (un != []))
for v in d.values():
ans *= pow(2, v, mod)
ans %= mod
print(ans)