Job Assignment 3
Time limit3sMemory limit256 MB
Each worker takes jobs only from a given eligible list, with K workers allowed two jobs, to finish as many of M jobs as possible.
- Level
Medium4 of 10
- Topics
- Graph
- Solved
- No attempts yet
Problem
Gangho's company has employees and jobs to finish. Employees are numbered 1 to , and jobs are numbered 1 to .
Each employee takes one job out of the jobs that employee can do, and each job is taken by one employee. of the employees can take up to two jobs.
Given the list of jobs each employee can do, write a program that finds the largest number of the jobs the company can finish.
Input
The first line contains the number of employees , the number of jobs , and the number of employees who can take two jobs . (, )
Each of the next lines describes one employee. The -th line contains the number of jobs employee can do, followed by the numbers of those jobs.
Output
Print the largest number of jobs Gangho's company can finish.
Note
In the first example, employee 1 takes two jobs. Employee 1 takes jobs 1 and 2, employee 2 takes job 3, and employee 3 takes job 5, so four jobs are finished.