Submission #1159744

#TimeUsernameProblemLanguageResultExecution timeMemory
1159744gelastropod3D Histogram (COCI20_histogram)C++20
20 / 110
2594 ms4536 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    int n, a, b;
    cin >> n;
    vector<pair<int, int>> vals;
    for (int i = 0; i < n; i++) {
        cin >> a >> b;
        vals.push_back({a, b});
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int minW = LLONG_MAX;
        int minH = minW;
        for (int j = i; j < n; j++) {
            minW = min(minW, vals[j].first);
            minH = min(minH, vals[j].second);
            ans = max(ans, minW * minH * (j - i + 1));
        }
    }
    cout << ans << '\n';
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...