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>
using namespace std;
#define int long long
signed main()
{
int n;
cin>>n;
int a,b,mna[n][n],mnb[n][n];
for (int i=0;i<n;i++)
{
cin>>a>>b;
mna[i][i]=a;
mnb[i][i]=b;
}
for (int i=0;i<n;i++)
for (int j=i+1;j<n;j++)
mna[i][j]=min(mna[i][j-1],mna[j][j]),mnb[i][j]=min(mnb[i][j-1],mnb[j][j]);
int ans=0;
for (int i=0;i<n;i++)
for (int j=i;j<n;j++)
ans=max(ans,(j-i+1)*mna[i][j]*mnb[i][j]);
cout<<ans<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |