|
||||||||||
Street FighterTime Limit: 20000/10000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1398 Accepted Submission(s): 552 Problem Description Street Fighter is a popular Fighting game. In the game, you could choose many roles to fight. Each role has some models, in different model the role has different super skill. Such as Ryu, he has two model -- "Metsu Hadoken" and "Metsu Shoryuken". In "Metsu Hadoken" model, Ryu could beat Chun-Li easyly and in "Metsu Shoryuken" he could beat Ken. Giving the information of which role in which model could beat which role in which model. Your task is choosing minimum roles in certain model to beat other roles in any model.(each role could only be chosen once) Input The first line is a number T(1<=T<=30), represents the number of case. The next T blocks follow each indicates a case. The first line of each case contains a integers N(2<=N<=25), indication the number of roles. (roles numbered from 0 to N - 1). Then N blocks follow, each block contain the information of a role. The first of each block contains a integer M(1<=M<=2), indication the number of model of this role.(models numbered from 0 to M - 1) Then M lines follow, each line contain a number K(1<=K<=10), then K pairs integers(role id and model id) follow, indicating the current role in this model could beat that role in such model. Output For each case, output the number of case and the minimum roles have to choose to reach the goal.(as shown in the sample output) Sample Input
Sample Output
Hint In the first sample, you must select all of roles, because one role couldn't beat the other role in any model. In the second sample, you can select role 0 with its model 0, and role 3 with its model 0, then role 1 and role 2 will to be defeated no matter which model they use. Author NotOnlySuccess Source | ||||||||||
|