No.1689 Set Cards
Problem Statement
You are given $N$ sets $A_1,$ $A_2,$ $\dots,$ $A_N$.
The set $A_i$ $(1 \le i \le N)$ has $k_i$ elements, and the set $A_i$ is $\{C_{i,1},$ $C_{i,2},$ $\dots,$ $C_{i,k_i}\}$.
Among the $2^N-1$ ways to choose $1$ or more of the $N$ sets, how many ways are there such that the intersection (common part) of all the chosen sets is the empty set?
Since the answer can be very large, output it modulo $998244353$.
Input
$N$
$k_1$ $C_{1,1}$ $\dots$ $C_{1,k_1}$
$k_2$ $C_{2,1}$ $\dots$ $C_{2,k_2}$
$\vdots$
$k_N$ $C_{N,1}$ $\dots$ $C_{N,k_N}$
- $1 \le N \le 500$
- $0 \le k_i \le 12$
- $1 \le C_{ij} \le 12$
- $C_{i,1},$ $C_{i,2},$ $\dots,$ $C_{i,k_i}$ are pairwise distinct
- All inputs are integers
Output
Output, modulo $998244353$, the number of ways among the $2^N-1$ ways to choose such that the intersection of all the chosen sets is the empty set. Print a newline at the end.
Sample
Sample 1
Input
3 2 1 2 2 1 3 2 2 3
Output
1
We have $A_1=\{1,2\}$,
$A_2=\{1,3\}$,
$A_3=\{2,3\}$.
Among the $7$ ways to choose, the intersection is the empty set only for the way that chooses all $3$ sets.
Sample 2
Input
4 0 0 0 0
Output
15
A given set may be the empty set.
Sample 3
Input
32 5 1 2 3 4 5 4 1 2 3 4 4 1 2 3 5 4 1 2 4 5 4 1 3 4 5 4 2 3 4 5 3 1 2 3 3 1 2 4 3 1 2 5 3 1 3 4 3 1 3 5 3 1 4 5 3 2 3 4 3 2 3 5 3 2 4 5 3 3 4 5 2 1 2 2 1 3 2 1 4 2 1 5 2 2 3 2 2 4 2 2 5 2 3 4 2 3 5 2 4 5 1 1 1 2 1 3 1 4 1 5 0
Output
301664622
Output the answer modulo $998244353$.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
ansain
Nachia