408279: GYM103076 B Is Kinho sus?

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Is Kinho sus?time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

The Among Us game was famous during the pandemic. The game consists of two groups of space travelers: crew and imposters. Crew members do not know who the imposters are, but each imposter knows who all the other imposters are.

The objective of the game is for all the crew to find out who the imposters are. Kinho loves to be an imposter, and has fun with his friends using only "facts and logic". However, after a certain period of the game, all players have opinions and think they can find out all the imposters.

Each player's opinion consists of a list of no more than five other players. It is guaranteed that, for each crew member, the opinion given contains at least one impostor. However, the opinion of each imposter does not contain any other imposter. Your task is simple, given the number of players, and for each player, their opinion, decide how many different combinations of imposters can exist so that there is no contradiction with the opinions given.

Input

The input consists of several lines. The first line will be an integer $$$N$$$, $$$1 <= N <= 20$$$, indicating the number of players. Then $$$N$$$ lines, the $$$i$$$-th line consists of an integer $$$S$$$, $$$0<= S <=5$$$,indicating the opinion of the $$$i$$$-th player, followed by $$$S$$$ integers $$$j$$$ indicating that the $$$j$$$-th player is suspicious. $$$1 <= j <= N$$$.

Output

The output must contain only an integer. The total number of different combinations of imposters, so that there is no contradiction in any combination found.

ExampleInput
5
2 2 3
2 1 4
3 2 4 5
0
2 1 2
Output
1

加入题单

算法标签: