Trapping Rain Water
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Given non-negative integers representing an elevation map where the width of each bar is .
Compute how much water it can trap after raining.
Input
The first line contains the value of .
The second line contains non-negative integers .
Output
Print how much water can be trapped after raining.
Examples
Input #1
Answer #1
Input #2
Answer #2
Submissions 302
Acceptance rate 49%