Histogram and Blue Rectangles
시간 제한2초메모리 제한512 MB
히스토그램의 각 접두사마다 그 안에 완전히 들어가는 가장 큰 직사각형의 넓이를 구한다.
문제
Consider an integer array of length where all are positive. Such an array may be represented as histogram. To draw the histogram, for each from 0 to we draw a blue rectangle with vertices , , , .
The rectangle with the vertices at integer points is called \emph{covered} by the histogram, if the sides are parallel to the coordinate axes, and all the internal points of the rectangle are blue.
For each between 1 and calculate the maximal area of the rectangle covered by first columns of the given histogram.
입력
The first line of the input contains one integer (), the length of the array . The second line contains integers; the -th of those integers represents ().
출력
Print integers, each on the new line. -th of those integers is the maximal area of the rectangle covered by first columns of the given histogram.