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

建议使用的浏览器:

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

3630:Crystal mine

题目描述
Legends always begin with the sentence “Long long ago......”
Long long ago, there is a kingdom. The border of this kingdom is rectangular, and some lakes in it. Old king divides land to N * M areas. So, we can regard this kingdom as a matrix. Every element of matrix is an area. This kingdom is famous for crystal mine, because every land contains an ocean of crystal underground, except lakes.
Now, the old king wants to build a large rectangular mine field in a rectangular range which is decide by him. What’s more, he wants to build a special area in mine field, which can produce crystal manyfold. Notice that mine field can't contain lakes. Unfortunately, the old king is too old to remember something. He always asks his adviser this question with different range.
Adviser is tired of answering those questions day by day. So, you are assigned to solve this problem. You get the kingdom map, and the amount of crystal of every area (as A[][]) has been marked on this map. You should find out the best plan to build this mine field which can produce most crystal. Old king never care the details of plan. The only thing he wants know is the number of crystal the mine field can produce.
输入解释
There are several test cases in the input file.
The first line of input file contains a number T, representing the number of test cases. For each test case:
First line contains four integers separated by a single blank, N (1 <= N <= 150), M (1 <= M <= 150), Q (1<= Q <= 200), S (1 <= S <= 10). The size of matrix is N * M. Q indicates the number of questions of old king. S indicates that, if you set the special area in (i,j), (i,j) will produce S * A[i][j] instead of A[i][j].
The following N lines, each line contains M number, the j-th number of i-th line represent A[i][j] (-1 <= A[i][j] < 100 ). Number -1 indicates that, this area is a lake. Otherwise A[i][j] indicates the amount of crystal in this area.
Following Q line, each line contains four integers p, q, x, y. (1 <= p <= x <= N, 1 <= q <= y <= M) indicating the rectangular range of this question is from (p,q) to (x,y). (p,q) is upper left corner of range, and (x,y) is lower right corner of range.
输出解释
For each test case, first line should contains “Case #: ”, ”#”is case number (starting from 1). Each of the following Q line contains a number indicating the answer of question.
Look at sample output for more details. There is a blank line between two consecutive test cases.
输入样例
1
4 4 3 2
1 -1 0 3
1 1 2 0
2 1 0 -1
1 4 6 1
1 1 1 1
1 1 3 3
1 3 3 4
输出样例
Case 1:
2
9
8
来自杭电HDUOJ的附加信息
Recommend lcy

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

源链接: HDU-3630

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

共提交 0

通过率 --%
时间上限 内存上限
5000/1500MS(Java/Others) 32768/32768K(Java/Others)