#P6442. [COCI 2011/2012 #6] KOŠARE
[COCI 2011/2012 #6] KOŠARE
Description
In an abandoned attic, there are boxes, and these boxes store types of toys. For the -th box, it contains toys (different boxes may contain the same toy).
Now you need to choose some of the boxes so that, among the chosen boxes, there are all types of toys (that is, every toy type is included). Find the total number of ways to choose such boxes ().
Input Format
The first line contains two integers .
The next lines each start with an integer ; then numbers describe which toys are contained in the -th box.
Output Format
Output one integer: the total number of valid selections ().
3 3
3 1 2 3
3 1 2 3
3 1 2 3
7
3 3
1 1
1 2
1 3
1
4 5
2 2 3
2 1 2
4 1 2 3 5
4 1 2 4 5
6
Hint
Constraints
- For of the testdata, , .
- For of the testdata, .
- For of the testdata, , , .
Notes
- This problem is translated from COCI2011-2012 CONTEST #6 T6 KOŠARE.
- Thanks to @一扶苏一 for translation support.
Translated by ChatGPT 5
京公网安备 11011102002149号