#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
#define fi first
#define se second
#define mp make_pair
typedef pair<int, pii> pip;
#define pb push_back
#define eb emplace_back
typedef long long ll;
const int MAXN = 2000, INF = 1000001;
int n;
int a[MAXN], b[MAXN];
int main(){
cin.tie(0); ios_base::sync_with_stdio(0);
cin >> n;
for(int i=0; i<n; i++){
cin >> a[i] >> b[i];
}
ll ans = 0;
for(int i=0; i<n; i++){
int ma = INF, mb = INF;
for(int j=i; j<n; j++){
ma = min(ma, a[j]);
mb = min(mb, b[j]);
ans = max(ans, 1LL*(j-i+1)*ma*mb);
}
}
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |