CF333D Characteristics of Rectangles
题目描述
Gerald 发现一个 n 行 m 列的表格。作为一个矩形表格的杰出专家,他立刻统计了表格的信息,即表格四个角数字的最小值。但是他并没有满足于最终结果:这个值太小了。为了让它更大,他准备对表格稍加修剪:删除左右的一些列,还有上下的几行。你需要找出在这样修剪后表格上述属性(即四角数字最小值)的最大值。请注意,在修剪后,表格要至少有 2 行 2列。剪去的行和列数目可以为 0。
输入格式
第一行包含两个用空格分隔的整数 n,m(2≤n,m≤1000) 。接下来 n 行描述这个表格。这些行的第 i 行包含用空格分隔的整数 $a_{i,1}$,$a_{i,2}$,...,$a_{i,m}$ ($0
输出格式
输出问题的答案。
说明/提示
In the first test case Gerald cannot crop the table — table contains only two rows and only two columns.
In the second test case if we'll crop the table, the table will contain zero in some corner cell. Also initially it contains two zeros in the corner cells, so the answer is 0.