#include <cstring>
#include <string.h>
#include <iostream>
#include <stdio.h>
#include <unordered_map>
#include <map>
#define ll long long
using namespace std;
#define TLE ios::sync_with_stdio(0),cin.tie(0)
const int INF = 0x3f3f3f3f;
int main() {
TLE;
int n, h[1005];
cin >> n;
for (int i = 1; i <= n; i++)
cin >> h[i];
int min_h = 0, max_a = 0;
for (int t = 1; t <= n; t++) {
min_h = h[t];
for (int i = t; i <= n; i++) {
if (h[i] < min_h) min_h = h[i];
if (max_a < min_h * (i - t + 1)) max_a = min_h * (i - t + 1);
}
}
cout << max_a << endl;
}
CCF 201312-3 最大的矩形
最新推荐文章于 2021-04-08 10:46:51 发布