제출 #460679

#제출 시각아이디문제언어결과실행 시간메모리
460679benson04023D Histogram (COCI20_histogram)C++14
20 / 110
5 ms460 KiB
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define F first
#define S second
#define ALL(x) x.begin(), x.end()
#define MEM(x) memset(x, 0, sizeof(x))
#define MEMS(x) memset(x, -1, sizeof(x))

#define eb emplace_back
#define ep emplace
#define mkp make_pair

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
/*------------------------------------------------------------------*/

const int N = 2005;

ll a[N], b[N];

inline void solve() {
	int n; cin >> n;
	for(int i = 0; i < n; ++i)
		cin >> a[i] >> b[i];
	ll ans = 0;
	for(int i = 0; i < n; ++i) {
		ll x = a[i], y = b[i];
		ans = max(ans, x * y);
		for(int j = i + 1; j < n; ++j) {
			x = min(x, a[j]), y = min(y, b[j]);
			ans = max(ans, x * y * (j - i + 1));
		}
	}
	cout << ans << '\n';
}

int main() {
	cin.tie(0), ios::sync_with_stdio(0);
	solve();
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...