点击打开链接
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <deque>
#include <list>
using namespace std;
int main()
{
int n;
vector<int> a;
cin >> n;
for (int i = 0; i < n; i++)
{
int x;
cin >> x;
a.push_back(x);
}
int ans = 0;
for (int i = 0; i < n; i++)
{
int h = a[i];
for (int j = i; j < n; j++)
{
if (a[j] < h)
h = a[j];
int s = (j - i + 1) * h;
if (ans < s)
ans = s;
}
}
cout << ans << endl;
return 0;
}