Submission #1016759

#TimeUsernameProblemLanguageResultExecution timeMemory
1016759vjudge13D Histogram (COCI20_histogram)C++17
20 / 110
235 ms524288 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...