{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n #problem-body \u003e pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv id\u003d\"problem-body\"\u003e\n\t\u003cp\u003e\r\n\r\nA histogram is a polygon composed of a sequence of rectangles aligned at a common base line.\r\nThe rectangles have equal widths but may have different heights.\r\nFor example, the figure on the left shows the histogram that consists of rectangles with the heights 2, 1, 4, 5, 1, 3, 3, measured in units where 1 is the width of the rectangles:\r\n\r\n\u003c/p\u003e\u003ccenter\u003e\r\n\u003cimg src\u003d\"CDN_BASE_URL/7ad3bdb3b3fc992a9cbb171beb79abfa?v\u003d1715721831\"\u003e\r\n\u003c/center\u003e\r\n\r\n\u003cp\u003e\r\nUsually, histograms are used to represent discrete distributions, e.g., the frequencies of characters in texts.\r\nNote that the order of the rectangles, i.e., their heights, is important.\r\nCalculate the area of the largest rectangle in a histogram that is aligned at the common base line, too.\r\nThe figure on the right shows the largest aligned rectangle for the depicted histogram.\r\n\r\n\u003c/p\u003e\u003ch3\u003eInput Specification\u003c/h3\u003e\u003cp\u003e\r\n\r\nThe input contains several test cases.\r\nEach test case describes a histogram and starts with an integer \u003ccode\u003en\u003c/code\u003e, denoting the number of rectangles it is composed of.\r\nYou may assume that \u003ccode\u003e1 \u0026lt;\u003d n \u0026lt;\u003d 100000\u003c/code\u003e.\r\nThen follow \u003ccode\u003en\u003c/code\u003e integers \u003ccode\u003eh\u003csub\u003e1\u003c/sub\u003e, ..., h\u003csub\u003en\u003c/sub\u003e\u003c/code\u003e, where \u003ccode\u003e0 \u0026lt;\u003d h\u003csub\u003ei\u003c/sub\u003e \u0026lt;\u003d 1000000000\u003c/code\u003e.\r\nThese numbers denote the heights of the rectangles of the histogram in left-to-right order.\r\nThe width of each rectangle is \u003ccode\u003e1\u003c/code\u003e.\r\nA zero follows the input for the last test case.\r\n\r\n\r\n\u003c/p\u003e\u003ch3\u003eOutput Specification\u003c/h3\u003e\u003cp\u003e\r\n\r\nFor each test case output on a single line the area of the largest rectangle in the specified histogram.\r\nRemember that this rectangle must be aligned at the common base line.\r\n\r\n\u003c/p\u003e\u003ch3\u003eSample Input\u003c/h3\u003e\u003cp\u003e\r\n\r\n\u003c/p\u003e\u003cpre\u003e7 2 1 4 5 1 3 3\r\n4 1000 1000 1000 1000\r\n0\r\n\u003c/pre\u003e\r\n\r\n\u003ch3\u003eSample Output\u003c/h3\u003e\u003cp\u003e\r\n\r\n\u003c/p\u003e\u003cpre\u003e8\r\n4000\r\n\u003c/pre\u003e\n\u003c/div\u003e"}}]}