#P5989. [PA 2019] Wina
[PA 2019] Wina
Description
A number tower is formed by stacking numbers in rows.
Given , you need to take away exactly numbers so that the minimum value among the taken numbers is as small as possible. A number can be taken if and only if there is no number at its upper-left and upper-right positions, or those numbers have already been taken.
Input Format
The first line contains two positive integers . The next lines describe the tower. The -th line contains positive integers $a[i][1], a[i][2], ..., a[i][i](1\le a[i][j]\le 2019)$, representing the number in the -th row from top to bottom and the -th position from left to right.
Output Format
Output one integer: the minimum possible value of the minimum among the taken numbers.
5 7
1999
2019 2010
850 1500 1600
900 900 710 900
1000 800 600 800 1000
710
Hint
For of the testdata, , .
Sample Explanation

Translated by ChatGPT 5
京公网安备 11011102002149号