rain-fill
Folders and files
Name | Name | Last commit date | ||
---|---|---|---|---|
parent directory.. | ||||
1D problem: Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. For example, Given [0,1,0,2,1,0,1,3,2,1,2,1], return 6. 2D problem: http://www.oi.edu.pl/old/php/show.php?ac=e181413&module=show&file=zadania/oi6/woda On a rectangular mesh comprising n*m fields, n*m cuboids were put, one cuboid on each field. A base of each cuboid covers one field and its surface equals to one square inch. Cuboids on adjacent fields adhere one to another so close that there are no gaps between them. A heavy rain pelted on a construction so that in some areas puddles of water appeared. Write a program which: reads from the text file WOD.IN a size of the chessboard and heights of cuboids put on the fields, computes maximal water volume, which may gather in puddles after the rain, writes results in the text file WOD.OUT.