样例输入
6
3 1 6 5 2 3
样例输出
10
#include <iostream>
#include <vector>
using namespace std;
int main(){
int n,max_s = 0;
vector<int> rect;
cin>>n;
for (int i = 0; i < n; ++i) {
int t;
cin>>t;
rect.push_back(t);
}
for (int i = 0; i < n; ++i) {
int w = 1,s = 0,h = rect[i];
while (h){
w = 1;
for (int j = i + 1; j < n; ++j) {
if(rect[j] < h) break;
++w;
}
s = w*h;
if(max_s < s)
max_s = s;
--h;
}
}
cout<<max_s;
}