Time limit
2s
Memory limit
128 MB
The cows like pizza, and they also enjoy choosing from many topping combinations. A pizza shop offers T toppings, numbered from 1 to T.
Some topping combinations are unacceptable to the cows. Each constraint is a set of topping numbers that must not all appear together. If a pizza contains every topping from any one constraint, that pizza is not counted as possible.
Count how many topping combinations can be made, including the pizza with no toppings.
T and N. 1 <= T <= 20 and 1 <= N <= 52.N lines describes one constraint. The first integer on the line is Z, the number of toppings in the constraint. 1 <= Z <= T.Z integers are the topping numbers whose joint presence makes a pizza impossible. The topping numbers in one constraint are distinct.