問題一覧 > 通常問題

No.2134 $\sigma$-algebra over Finite Set

レベル : / AI推定難易度 : 1375 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 59
作問者 : だれ / テスター : nok0 ぷら taiga0629kyopro shift_aaaa
お気に入りにしたユーザー ProblemId : 8599 / 自分の提出
問題文最終更新日: 2025-10-14 00:42:19
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 369 (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。