#P2219. [HAOI2007] 修筑绿化带
[HAOI2007] 修筑绿化带
Description
To enhance the park’s scenery, we need to build a flowerbed in the park and, around the flowerbed, construct a green belt so that the flowerbed is enclosed by the green belt.
If we regard the park as an rectangle, then the flowerbed can be regarded as a rectangle, and the green belt together with the flowerbed can be regarded as an rectangle.
If we define the fertility of a rectangular land region as the sum of the fertility values of all unit cells within that region, then the fertility of the green belt equals the fertility of the block minus the fertility of the block.
To make the green belt grow vigorously, we want the fertility of the green belt to be maximized.
Input Format
The first line contains six positive integers .
Then follows an numeric matrix. The element in row and column is an integer , representing the fertility of the land at row and column of the park.
Output Format
Output a single positive integer, the maximum fertility of the green belt.
4 5 4 4 2 2
20 19 18 17 16
15 14 13 12 11
10 9 8 7 6
5 4 3 2 1
132
Hint
For of the testdata, .
For of the testdata, , , , , , .
Translated by ChatGPT 5
京公网安备 11011102002149号