{"trustable":false,"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":"statement","value":{"format":"HTML","content":"\u003cdiv id\u003d\"problem-body\"\u003e\n \u003cp\u003eIn this task, you will be presented with a bar chart consisting of columns, each having a width of 1. Your objective is to identify the rectangle within this chart that has the largest area. To illustrate, consider the following example, which represents a column graph comprising rectangles with lengths of 2, 1, 4, 5, 1, 3, and 3:\u003c/p\u003e\n \u003ccenter\u003e\n \u003cimg src\u003d\"CDN_BASE_URL/7ad3bdb3b3fc992a9cbb171beb79abfa?v\u003d1683832233\"\u003e\n \u003c/center\u003e\n \u003cp\u003eIn general, bar charts are used to show the distribution of a data. The figure on the right shows the rectangle that is the largest rectangle of the graph 2, 1, 4, 5, 1, 3, 3. This rectangle has an area of 8, and there are no rectangles below the graph with an area greater than 8.\u003c/p\u003e\n \nAnd now the current task is to find the largest rectangle within the boundaries of the bar chart."}},{"title":"input","value":{"format":"HTML","content":"The input contains several test cases.\nEach test case describes a histogram and starts with an integer $n(1 \\leq n \\leq 10^5)$, denoting the number of rectangles it is composed of.\nThen follow $n$ integers $a-i(0 \\leq a_i 10^9)$\n\nThe thickness of each rectangle is $1$. $0$ indicates the end of the tests and ends when $0$ is read instead of $n$."}},{"title":"output","value":{"format":"HTML","content":"Print a single integer with each test case, the area of the largest rectangle."}},{"title":"sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e7 2 1 4 5 1 3 3\n4 1000 1000 1000 1000\n0\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e8\n4000\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}}]}