~/algor $ cat problems/matritsa-qator-maksimumlari-minimumi
Smallest of the row maximums
Easy
1000 ms
128 MB
26%
An integer matrix of size $n \times m$ is given. Among the largest elements of the rows, find the smallest one:
$$V = \min_{1 \le i \le n} \left( \max_{1 \le j \le m} a_{i,j} \right)$$
Input
The first line contains two positive integers $n$ and $m$. Each of the next $n$ lines contains $m$ integers.
Output
One integer — the smallest of the row maximums.
Note
$1 \le n, m \le 200$
$-1000 \le a_{i,j} \le 1000$
Examples
Input #1
3 3 1 7 3 4 2 5 9 8 6
Output #1
5
Input #2
1 3 -1 -2 -3
Output #2
-1