#Lutece1144. Big Brother
Big Brother
Migrated from Lutece 1144 Big Brother
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
现在有个囚笼,需要关押个犯人,the big brother很担心囚笼的安全性,因为犯人都有自己的想法,他们只想住在特定的囚笼里面,那么big brother想知道最多 能关押多少个犯人,每个囚笼只能关押一个犯人,一个犯人也只能关押在一个囚笼里面。
Input
第一行 两个整数, 和 。 是犯人的数量, 是囚笼的数量。
第二行到第行 一共 行,每行对应一只犯人。第一个数字 是这哥犯人愿意待的囚笼的数量 。后面的个数表示这些囚笼的编号。
囚笼的编号限定在区间 中,在同一行,一个囚笼不会被列出两次。
Output
只有一行。输出一个整数,表示最多能分配到的囚笼的数量.
Samples
5 5
1 1
1 2
1 3
1 4
1 5
5
Resources
2015 UESTC Training for Graph Theory