#B4470. 矩阵游戏 / matrix
矩阵游戏 / matrix
Problem Description
Xiaoshan and Xiaoxi are playing a matrix game:
There is an matrix. Xiaoshan can choose a value for each row as the representative value of that row. Xiaoxi will then select two numbers from these representative values and take the absolute difference.
Xiaoshan wants the difference chosen by Xiaoxi to be as small as possible; Xiaoxi wants the difference she selects to be as large as possible.
Please calculate, assuming both players adopt optimal strategies, what is the absolute difference between the two representative values that Xiaoxi ultimately selects?
Input Format
The first line contains two integers .
The next lines each contain integers.
Output Format
An integer representing the final difference.
3 3
1 2 9
4 5 6
7 8 3
2
Hint
[Sample Explanation]
When both choose optimal strategies, Xiaoshan selects as the representative values for the three rows. From this set, Xiaoxi chooses the two numbers with the largest difference, and , resulting in a maximum difference of . This is the minimum maximum difference that Xiaoshan can ensure.
[Constraints]
For of the data, .
For another of the data, .
For another of the data, .
For another of the data, .
For of the data, , and the absolute values of the integers in the matrix do not exceed .
Translated by DeepSeek-V3