Container With Most Water
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
There is an array of integers of length , representing the heights of vertical lines. For each -th line, its endpoints are defined by the coordinates and .
Find two lines that, together with the -axis, form a container capable of holding the maximum amount of water.
Input
The first line contains the size of the array . The second line contains positive integers, the elements of the array , each of which does not exceed .
Output
Print the maximum volume of water that the container can hold.
Examples
Input #1
Answer #1
Submissions 1K
Acceptance rate 39%