当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6323:Problem E. Find The Submatrix

题目描述
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.
输入解释
The first line of the input contains an integer $T(1\leq T\leq10)$, denoting the number of test cases.
In each test case, there are $4$ integers $n,m,A,B(1\leq n\leq 100,1\leq m\leq 3000,0\leq A\leq 10000,1\leq B\leq 3)$.
Each of the following $n$ lines contains $m$ integers, the $j$-th number on the $i$-th of these lines is $w_{i,j}(|w_{i,j}|\leq 10^9)$, denoting the value of each cell.
输出解释
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
输出样例
7
8
来自杭电HDUOJ的附加信息
Recommend chendu

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6323

最后修改于 2020-10-25T23:30:17+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
6000/3000MS(Java/Others) 524288/524288K(Java/Others)