Moo University - Emergency Pizza Order
Time limit1sMemory limit1024 MB
Given each calf's liked toppings out of T, find the maximum number of calves that can each receive a distinct K-topping pizza made only from toppings they like.
- Level
Medium7 of 10
- Topics
- Graph, Combinatorics, Bit manipulation
- Solved
- No attempts yet
Problem
Moo U's cafeteria has run out of hay, so it must order pizzas for the calves () attending Moo U. Conveniently, a large pizza from the local pizzeria, Pizza Farm, serves exactly one calf.
Pizza Farm will make one pizza per calf, but because the order is large, it sets three conditions:
- Pizza Farm has a list of vegetarian toppings (). Each pizza must have exactly toppings ().
- No topping can appear twice on one pizza. For example, a pizza cannot have onions and onions.
- No two pizzas in the order can have the same set of toppings. For example, if pizza 1 has onions, green peppers, pineapples, and wheat grass, then no other pizza can have that exact set. Pizza 2 may still have onions, green peppers, pineapples, and olives.
For ordering purposes, the toppings are numbered 1 to .
The calves at Moo U are picky, and some do not like every topping. A calf eats a pizza only if she likes every topping on it. Find the maximum number of calves that can be fed.
Input
The first line contains three integers , , and .
Each of the next lines describes the toppings one calf likes. The first integer on the line is the number of toppings that calf likes. The remaining integers are the numbers of those toppings.
Output
Print a single integer: the maximum number of calves that can be fed.