3435. Puzzle Game

单点时限: 1.5 sec

内存限制: 512 MB

Once upon a time, there was a little dog YK. One day, he went to an antique shop and was impressed by a beautiful picture. YK loved it very much. However, YK did not have money to buy it. He begged the shopkeeper Bob whether he could have it without spending money.

Fortunately, Bob enjoyed puzzle game. He promised to give YK a picture for free if YK can solve a puzzle game for him.

Bob drew a puzzle board, which was a matrix consisting of cells. And there was an integer in each cell. A sub-matrix was a matrix that was a continuous part of the puzzle board (The whole puzzle board could also be called a sub-matrix). The value of a sub-matrix meant the sum of integers in the cells of the sub-matrix. The sub-matrix which had the largest value was called “The largest sub-matrix”. Bob wanted to make the value of the largest sub-matrix as small as possible by selecting one cell on the board and changed the integer in it into . But if making that kind of change would not do anything good, he didn’t have to change any cell.

In such a situation, YK needed to calculate the minimum value of the largest sub-matrix Bob could get.

输入格式

The first line contains three integers, above mentioned , and ().

Then lines follow. Each line contains integers ().

These lines are the integers in the cells of the puzzle board.

输出格式

Output the minimum value of the largest sub-matrix Bob could get.

样例

Input
3 3 -10
-100 4 4
4 -10 4
4 4 1
Output
8
Input
3 3 -1
-2 -2 -2
-2 -2 -2
-2 -2 -2
Output
-2

1 人解决,1 人已尝试。

2 份提交通过,共有 2 份提交。

8.9 EMB 奖励。

创建: 2 年,2 月前.

修改: 2 年,2 月前.

最后提交: 2 年,1 月前.

来源: Beijing 2017

题目标签