QOJ.ac

QOJ

时间限制: 1.0 s 内存限制: 512 MB 总分: 100

#11749. 宾果

统计

考虑如下游戏。你有一个大小为 $N \times M$ 的整数矩阵。你的任务是在矩阵的某些单元格中放置 $M$ 个标记,使得:

  1. 每一列恰好包含一个标记;
  2. 每一行中标记数量的最大值与最小值之差 $D_r$ 尽可能小;
  3. 在所有满足上述条件的标记放置方案中,选择使得包含标记的矩阵单元格中的最大值尽可能小的一种。

输入格式

输入的第一行包含两个整数 $N$ 和 $M$ ($1 \le N, M \le 110$)。接下来是矩阵 $a_i$:共 $N$ 行,每行包含 $M$ 个整数 $a_{i,j}$ ($1 \le a_{i,j} \le 10^9$)。

输出格式

输出两个整数,描述你找到的放置方案:$D_r$ 的最小值,以及包含标记的矩阵单元格中的最大值的最小值。

样例

样例输入 1

3 3
1 2 3
2 1 2
3 2 1

样例输出 1

0
1

样例输入 2

3 5
1 2 3 4 5
5 4 3 2 1
4 3 2 1 5

样例输出 2

1
2

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.