DWITE Online Computer Programming Contest, February 2011, Problem 5
Cube world is a magical place where the land is made up of cubes stacked on top of each other to form towers. You can think of this world as an
One day, it starts to rain heavily on cube world. Being the world's leading computer scientist, you want to determine the maximum volume of water that can amass in the cavities of cube world:
The input file will contain 5 test cases. The first line consists of two numbers
The output should contain 5 lines, where each line represents the maximum volume of water that can be stored in each cube world.
Cite: the question idea, and pictures, are from Stage 3 of the 6th Polish Olympiad of Informatics.
Sample Input
3 6
3 3 4 4 4 2
3 1 3 2 1 4
7 3 1 6 4 1
Sample Output
5
Problem Resource: DWITE
Comments