#P6063. [USACO05JAN] The Wedding Juicer G
[USACO05JAN] The Wedding Juicer G
Description
John’s cows found a nice part-time job: designing a punch-style juicer. The juicer is designed as follows.
There is a base of size (). On each cell, there is a pillar of height () used for juicing. Assume that the pillars are perfectly glued together, so water will not leak through the gaps between pillars.
However, John has never known how much juice such a juicer can hold. Assume there is nothing around the juicer, which means water on the boundary will flow away. Some juicers cannot hold any juice at all.
Input Format
The first line contains two integers and .
The next lines each contain numbers, representing the heights.
Output Format
Output the maximum amount of juice it can hold.
4 5
5 8 7 7
5 2 1 5
7 1 7 1
8 9 6 9
9 8 9 9
12
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号