1045 - Task Arrangement II

Time Limit : 1 Second

Memory Limit : 64 MB

Submission: 87

Solved: 29

Description
There are N tasks and M resources, each task is asked to use some resources and each resource can only be used by at most one task.
You are asked to find the best arrangement to maximum the total number of the compatible tasks.
Input
There are multi test cases.
Each case contains a number of lines. The first line is N and M, 1 <= N, M <= 50. In the following N lines, each task contains one line with many integers separated by exactly one space, which specify the required resources. The index of the resources starts from 0.
Output
For each test case, output one line containing the maximum number of the compatible tasks.
sample input
5 5
0 3 1
1 4
2 1
0
3 2
3 3
1 0
0 2
1 2
sample output
3
1
hint
source
Du Peng
© 2015 HUST ACMICPC TEAM. All Right Reserved.