22193_Reassign

2022-5-16 18:21| 发布者: Hocassian| 查看: 26| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506189790600-Problem List-采集的数据-后羿采集器.html

Pro.ID

22193

Title

Reassign

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22193

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    We have N employees and M tasks, MN. 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 ≤ NM ≤ 50, 1 ≤ Vij ≤ 10000.

    输出

    Description

    We have N employees and M tasks, MN. 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 ≤ NM ≤ 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
    2 1 3
    3 2 4
    1 26 2
    2 1 3
    2 3
    1 2 3
    1 2 3
    1 2

    Sample Output

    2 26
    1 2

    Source

    样例输入

    3 3
    2 1 3
    3 2 4
    1 26 2
    2 1 3
    2 3
    1 2 3
    1 2 3
    1 2

    样例输出

    2 26
    1 2

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部