Problem E. Problem E. Find The Submatrix
时间限制 3000 ms
内存限制 512 MB
Little Q is searching for the submatrix with maximum sum in a matrix of $n$ rows and $m$ columns. The standard algorithm is too hard for him to understand, so he (and you) only considers those submatrixes with exactly $m$ columns.
It is much easier now. But Little Q always thinks the answer is too small. So he decides to reset no more than $A$ cells' value to $0$, and choose no more than $B$ disjoint submatrixes to achieve the maximum sum. Two submatrix are considered disjoint only if they do not share any common cell.
Please write a program to help Little Q find the maximum sum. Note that he can choose nothing so the answer is always non-negative.
输入数据
输出数据
For each test case, print a single line containing an integer, denoting the maximum sum.
样例输入
复制
2
5 1 0 1
3
-1
5
-1
-2
5 1 1 1
3
-1
5
-1
-2
样例输出
$ Mathjax font initiator $