Submission #1159665

#TimeUsernameProblemLanguageResultExecution timeMemory
1159665YSH20203D Histogram (COCI20_histogram)C++20
20 / 110
2594 ms3396 KiB
#include <bits/stdc++.h>
using namespace std;

#define int long long

signed main() {
	int n; cin >> n;
	vector<pair<int,int>> a(n); for (int i = 0; i < n; i++) cin >> a[i].first >> a[i].second;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int h = a[i].first, w = a[i].second;
		ans = max(ans, h*w);
		for (int j = i-1; j >= 0; j--) {
			h = min(h, a[j].first);
			w = min(w, a[j].second);
			ans = max(ans, h*w*(i-j+1));
		}
	}
	cout << ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...