#d11103. 新年的问题(数据加强版)
新年的问题(数据加强版)
New Year's Problem (Enhanced Version)
Problem Description
Given an matrix, you must choose exactly one number from each column, such that among these chosen numbers there exist two that are in the same row. Maximize the minimum of these chosen numbers, and output that value.
Input Format
The first line contains two positive integers .
The next lines each contain positive integers.
Output Format
One positive integer.
Sample Input
2 2
1 2
3 4
Sample Output
3
Sample Explanation
, which requires choosing from at most row, i.e. only one row can be chosen. Choosing the first row gives with minimum ; choosing the second row gives with minimum . So the answer is .
Constraints
.
All numbers appearing are at most .
- Further note: A binary search solution can pass after optimizing input, but you may also try an approach.