This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define ST first
#define ND second
#define PB push_back
using namespace std;
using ll = long long;
using pi = pair<int,int>;
using vi = vector<int>;
const int nax = 2000 + 10, INF = 1e9;
int a[nax], b[nax], n;
ll ans;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for(int i = 0; i < n; ++i) {
cin >> a[i] >> b[i];
}
for(int l = 0; l < n; ++l) {
int A = INF, B = INF;
for(int r = l; r < n; ++r) {
A = min(A, a[r]);
B = min(B, b[r]);
ans = max(ans, (ll)A * B * (r - l + 1));
}
}
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |