| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 166 | 74 | 60 | 48.387% |
In your city, there is a shortage of drinking water so the city planner is finding more ways to trap rainwater to be used for drinking. The city has varying heights of buildings, and rainwater gets trapped between the buildings. The city planner has asked you to write a program that, given the heights of the buildings, can find the largest amount of rainwater that can get trapped between the buildings.
The first line will contain a single integer n that indicates the number of data sets that follow. Each data set will consist of a single line of integers, denoting the heights of the buildings. The building height can be positive or negative.
Output the total amount of rainwater that can be trapped between/above the buildings of varying height.
2 5 0 0 0 5 6 3 1 6 4 5 1 0 3 5 3 1 4
15 24
School > PLU High School Programming Contest > PLU 2020 > Novice 8번