Submission #915380

#TimeUsernameProblemLanguageResultExecution timeMemory
915380vjudge13D Histogram (COCI20_histogram)C++17
20 / 110
2580 ms6088 KiB
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define int ll
#define ii pair<int,int>
#define F first
#define S second
#define endl '\n'

signed main(){
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for(int i=0; i<n; ++i){
        cin >> a[i] >> b[i];
    }

    int ans = 0;
    for(int r=0; r<n; ++r){
        int mnA = 1e7, mnB = 1e7;
        for(int l=r; l>=0; --l){
            mnA = min(mnA, a[l]);
            mnB = min(mnB, b[l]);
            ans = max(ans, (r-l+1) * mnA * mnB);
        }       

    }
    cout << ans;

}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...