#abc289c. C - Coverage
C - Coverage
Score : points
问题描述
设有 个集合,分别记作 ,包含从 到 的整数。
其中,集合 包含 个整数 。
从这 个集合中选择一个或多个集合的方式有 种。
其中满足以下条件的组合方式有多少种?
- 对于所有满足 的整数 ,至少有一个被选中的集合包含 。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
There are sets, called , consisting of integers between and .
consists of integers .
There are ways to choose one or more sets from the sets.
How many of them satisfy the following condition?
- For all integers such that , there is at least one chosen set containing .
Constraints
- $1 \leq a_{i,1} \lt a_{i,2} \lt \dots \lt a_{i,C_i} \leq N$
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the number of ways to choose sets that satisfy the conditions in the Problem Statement.
Sample Input 1
3 3
2
1 2
2
1 3
1
2
Sample Output 1
3
The sets given in the input are $S_1 = \lbrace 1, 2 \rbrace, S_2 = \lbrace 1, 3 \rbrace, S_3 = \lbrace 2 \rbrace$.
The following three ways satisfy the conditions in the Problem Statement:
- choosing ;
- choosing ;
- choosing .
Sample Input 2
4 2
2
1 2
2
1 3
Sample Output 2
0
There may be no way to choose sets that satisfies the conditions in the Problem Statement.
Sample Input 3
6 6
3
2 3 6
3
2 4 6
2
3 6
3
1 5 6
3
1 3 6
2
1 4
Sample Output 3
18
update @ 2024/3/10 12:04:22