Submission #741740

#TimeUsernameProblemLanguageResultExecution timeMemory
741740lalig7773D Histogram (COCI20_histogram)C++14
20 / 110
2544 ms4528 KiB
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main(){
    int n;
    cin>>n;
    vector<pair<int,int>>histo(n);
    for (int i=0; i<n; i++) cin>>histo[i].first>>histo[i].second;
    long long int ans=0;
    for (int i=0; i<n; i++){
        int x=histo[i].first, y=histo[i].second;
        for (int j=i; j<n; j++){
            if (histo[j].first<x) x=histo[j].first;
            if (histo[j].second<y) y=histo[j].second;
            ans=max(ans, (long long int)x*y*(j-i+1));
        }
    }cout<<ans<<endl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...