Pro.ID22193 TitleReassign Title链接http://10.20.2.8/oj/exercise/problem?problem_id=22193 AC0 Submit0 Ratio- 时间&空间限制描述We have N employees and M tasks, M ≥ N. One employee can get only one task. One task can be assigned to only one employee. If employee i takes job j, we can get value Vij. We have a assignment plan already, and now we want to change some employees' assignments, making the total value larger. And we want to change as less employees as possible. 输入For each test case, the first line contains two numbers N and M. N lines follow. Each contains M integers, representing Vij. The next line contains N integers. The first one represents the job number that employee I takes, and so on. 1 ≤ N ≤ M ≤ 50, 1 ≤ Vij ≤ 10000. 输出Description We have N employees and M tasks, M ≥ N. One employee can get only one task. One task can be assigned to only one employee. If employee i takes job j, we can get value Vij. We have a assignment plan already, and now we want to change some employees' assignments, making the total value larger. And we want to change as less employees as possible. Input For each test case, the first line contains two numbers N and M. N lines follow. Each contains M integers, representing Vij. The next line contains N integers. The first one represents the job number that employee I takes, and so on. 1 ≤ N ≤ M ≤ 50, 1 ≤ Vij ≤ 10000. Output For each the case print two integers X and Y. X represents the number of employees whose jobs had been changed. Y represents the maximum total value can be increased when changed X employees' jobs. If no answer, print "0 0". Sample Input 3 3 Sample Output 2 26 Source 样例输入3 3 样例输出2 26 作者 |