Submission #366490

#TimeUsernameProblemLanguageResultExecution timeMemory
366490Vimmer3D Histogram (COCI20_histogram)C++14
20 / 110
2580 ms1740 KiB
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

//#pragma GCC optimize("-O3")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-Ofast")

#define N 200500
#define NN 205000
#define PB push_back
#define endl '\n'
#define pri(x) cout << x << endl
#define _ << " " <<
#define all(x) x.begin(), x.end()
#define sz(x) int(x.size())
#define M ll(1e9 + 7)
#define F first
#define S second

using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef short int si;
typedef unsigned long long ull;

//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int main()
{
    ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0);

//    freopen("1.in", "r", stdin);

    int n;

    cin >> n;

    int a[n], b[n];

    for (int i = 0; i < n; i++) cin >> a[i] >> b[i];

    ll ans = 0;

    for (int i = 0; i < n; i++)
    {
        int mna = a[i], mnb = b[i], len = 0;

        for (int j = i; j < n; j++)
        {
            len++;

            mna = min(mna, a[j]);

            mnb = min(mnb, b[j]);

            ans = max(ans, 1ll * mna * mnb * len);
        }
    }

    pri(ans);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...