#P4014. 分配问题

    ID: 2947 远端评测题 1000ms 250MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>O2优化深度优先搜索,DFS二分图最大流费用流网络流 24 题

分配问题

Description

There are nn jobs to be assigned to nn people. When person ii does job jj, the benefit is cijc_{ij}. Design an assignment that assigns nn jobs to nn people so that the total benefit is minimized or maximized.

Input Format

The first line contains one positive integer nn, indicating there are nn jobs to be assigned to nn people. In the next nn lines, each line contains nn integers ci,jc_{i,j}, where ci,jc_{i,j} is the benefit when person ii does job jj.

Output Format

Output two lines: the minimum total benefit and the maximum total benefit, respectively.

5
2 2 2 1 2
2 3 1 2 4
2 0 1 1 1
2 3 4 3 3
3 2 1 2 1
5
14

Hint

1n50,0ci,j1001 \leq n \leq 50, 0 \le c _ {i, j} \le 100.

Each person can do only one job.

Translated by ChatGPT 5