暴力枚举
#include <iostream>
#include <vector>
using namespace std;
int n;
int main(void) {
scanf("%d", &n);
vector<int> h(n);
for (int i = 0; i < n; ++i)
cin >> h[i];
int ans = 0;
for (int i = 0; i < n; ++i) {
int l = i, r = i;
while (l >= 0 && h[l] >= h[i]) --l;
while (r < n && h[r] >= h[i]) ++r;
ans = max(ans, h[i] * (r - l - 1));
}
printf("%d\n", ans);
}