No.2134 $\sigma$-algebra over Finite Set
タグ : / 解いたユーザー数 59
作問者 :
だれ
/ テスター :
nok0
ぷら
taiga0629kyopro
shift_aaaa
Problem Statement
There is a set $X = \{1, 2, \ldots, N\}$. Let $\mathcal{P}(X)$ be the set of all subsets of $X$.
A subset $S$ of $\mathcal{P}(X)$ is called a good set if it satisfies the following conditions.
- $\varnothing \in S$
- If $A \in S$, then $A^c \in S$ ($A^c$ denotes the complement of $A$)
- If $A, B \in S$, then $A \cup B \in S$
You are given subsets $A_1, A_2, \ldots, A_M$ of $X$. For each $i\ (1\leq i\leq M)$, $A_i$ has $l_i$ elements, which are $a_{i, 1}, a_{i, 2}, \ldots, a_{i, l_i}$.
Find the number of elements of the good set with the minimum number of elements among those containing all of them.
Since this value can be very large, output it modulo $998244353$.
Input
The input is given in the following format.
$N$ $M$
$l_1$ $a_{1, 1}$ $a_{1, 2}$ $\ldots$ $a_{1, l_1}$
$l_2$ $a_{2, 1}$ $a_{2, 2}$ $\ldots$ $a_{2, l_2}$
$\vdots$
$l_M$ $a_{M, 1}$ $a_{M, 2}$ $\ldots$ $a_{M, l_M}$
Constraints
- All input values are integers.
- $1\leq N\leq 1000$
- $0\leq M\leq 1000$
- $1\leq l_i\leq N$
- $1\leq a_{i, j} \leq N$
- For each $i\ (1\leq i\leq M)$, the values $a_{i, j}\ (1\leq j\leq l_i)$ are pairwise distinct.
Output
Print the required value modulo $998244353$ on $1$ line.
Sample
Sample 1
Input
3 2 2 1 2 2 1 3
Output
8
$S = \{\varnothing, \{1\}, \{2\}, \{3\}, \{1, 2\}, \{1, 3\}, \{2, 3\}, \{1, 2, 3\} \}$ is the set with the minimum number of elements that satisfies the conditions.
Sample 2
Input
1 0
Output
2
$S = \{\varnothing, \{1\}\}$.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。