2 人解决,2 人已尝试。
3 份提交通过,共有 98 份提交。
8.6 EMB 奖励。
单点时限: 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 $n \times m$ matrix consisting of $n \times m$ 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 $P$. 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 $n$, $m$ and $P$ ($1 \le n,m \le 300, -10^9 \le P \le 10^9$).
Then $n$ lines follow. Each line contains $m$ integers $x_1,x_2, \ldots, x_m$ ($-10^9 \le x_i \le 10^9, i = 1,2, \ldots, m$).
These $n$ lines are the $n \times m$ integers in the $n \times m$ cells of the puzzle board.
Output the minimum value of the largest sub-matrix Bob could get.
3 3 -10 -100 4 4 4 -10 4 4 4 1
8
3 3 -1 -2 -2 -2 -2 -2 -2 -2 -2 -2
-2
2 人解决,2 人已尝试。
3 份提交通过,共有 98 份提交。
8.6 EMB 奖励。