Maximum Bipartite Matching
Easy Accuracy: 26.1% Submissions: 1413 Points: 2

There are M job applicants and N jobs. Each applicant has a subset of jobs that he/she is interseted in. Each job opening can only accept one applicant and a job applicant can be appointed for only one job. Find an assignment of jobs to applicant in such that as many applicants as possible get jobs.

Input:
First line consists of test case T. First line of every test case consists of two integers M and N. Second line of every test case consists of M*N spaced bool values(0 and 1).

Output:
Returns a integer value, denoting the  number of applicants can get the job.

Constraints:
1<=T<=100
1<=M,N<=10

Example:
Input:

1
6 6
0 1 1 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1
Output:
5

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.