Submission #369315

# Submission time Handle Problem Language Result Execution time Memory
369315 2021-02-21T09:50:28 Z kartel 3D Histogram (COCI20_histogram) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define in(x) freopen(x, "r", stdin)
#define out(x) freopen(x, "w", stdout)
//#include <time.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-O3")
#define F first
#define S second
#define pb push_back
#define M ll(1e9 + 7)
#define sz(x) (int)x.size()
#define re return
#define oo ll(1e18)
#define el '\n'
#define pii pair <ll, ll>
#define all(x) (x).begin(), (x).end()
#define arr_all(x, n) (x + 1), (x + 1 + n)
#define vi vector<int>
using namespace std;
typedef long long ll;
//using namespace __gnu_pbds;
//typedef tree <ll, null_type, less_equal <ll> , rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef long double ld;
typedef unsigned long long ull;
typedef short int si;

const int N = 2e5 + 500;
const int MS = 1e6;

ll sfa[N], sfb[N], pra[N], prb[N], a[N], b[N];
ll ans;
int n;

int root[4 * N];
ll lst[MS], cr[MS];
pair <ll, ll> ln[MS];
int siz;

int add(ll k, ll b) {
    int v = siz++;
    ln[v] = {k, b};

    return siz - 1;
}

ll cross(ll k, ll b, ll k1, ll b1) {
    return ((b - b1) / (k1 - k) + !!((b - b1) % (k1 - k)));
}

void build(int v, int l, int r) {
    int i = l;
    while (i <= r && prb[l] == prb[i])
        i++;

    root[v] = add(-prb[i - 1], prb[i - 1] * i);
    lst[root[v]] = root[v];
    cr[root[v]] = -1e18;

    int last = root[v];

    for (; i <= r;) {
        int j = i;
        while (i <= r && prb[i] == prb[j])
            i++;

        ll k = -prb[i - 1], b = prb[i - 1] * i;
        ll crp;

        while (1) {
            crp = cross(k, b, ln[last].F, ln[last].S);

            if (crp > cr[last])
                break;

            last = lst[last];
        }

        root[v] = add(k, b);
        lst[root[v]] = last;
        cr[root[v]] = crp;
        last = root[v];
    }

    if (l == r)
        return;

    int md = (l + r) >> 1;

    build(v * 2, l, md);
    build(v * 2 + 1, md + 1, r);
}

void upd_a(ll vl) {
    ans = max(ans, vl);
}

ll get(int v, int l, int r, int tl, int tr, int X) {
    if (l > r || tl > tr || tl > r || l > tr)
        return -1e18;

    if (l == tl && r == tr) {
        while (cr[root[v]] > X)
            root[v] = lst[root[v]];

        return ln[root[v]].F * X + ln[root[v]].S;
    }

    int md = (l + r) >> 1;

    return max(get(v * 2, l, md, tl, min(md, tr), X),
               get(v * 2 + 1, md + 1, r, max(md + 1, tl), tr, X));
}

void solve(int le, int ri) {
    if (le > ri)
        return;

    if (le == ri) {
        upd_a(a[le] * b[le]);
        return;
    }

    int md = (le + ri) >> 1;

    /// f -> [le, md], g -> [le, md]
    pra[md] = prb[md] = 1e9;
    for (int i = md + 1; i <= ri; i++) {
        pra[i] = min(pra[i - 1], a[i]);
        prb[i] = min(prb[i - 1], b[i]);
    }

    int r = md + 1, f = 1e9, g = 1e9;

    for (int l = md; l >= le; l--) {
        f = min(f, a[l]);
        g = min(g, b[l]);
        while (r <= ri && pra[r] >= f && prb[r] >= g)
            r++;

        upd_a((r - l) * 1ll * f * g);
    }

    ///f -> [md, ri], g -> [md; ri]

    sfa[md] = sfb[md] = 1e9;
    for (int l = md - 1; l >= le; l--) {
        sfa[l] = min(sfa[l + 1], a[l]);
        sfb[l] = min(sfb[l + 1], b[l]);
    }

    int l = md - 1;
    f = 1e9, g = 1e9;

    for (int r = md; r <= ri; r++) {
        f = min(f, a[r]);
        g = min(g, b[r]);
        while (l >= le && sfa[l] >= f && sfb[l] >= g)
            l--;

        upd_a((r - l) * 1ll * f * g);
    }

    /// f -> [le, md], g -> [md + 1, ri]

    siz = 0;

    build(1, md + 1, ri);

    f = 1e9, g = 1e9;
    r = md + 1;
    int r1 = md + 1;

    for (int l = md; l >= le; l--) {
        f = min(f, a[l]);
        g = min(g, b[l]);

        while (r <= ri && g < prb[r])
            r++;

        while (r1 <= ri && f <= pra[r1])
            r1++;

        if (r <= r1 - 1) {
            ll cur = get(1, md + 1, ri, r, r1 - 1, l);

//            cerr << f * cur << el;

            if (cur != -1e18) {
                upd_a(f * 1ll * cur);
            }
        }
    }

    /// g -> [le, md], f -> [md + 1, ri]

    siz = 0;

    for (int i = md + 1; i <= ri; i++) {
        swap(pra[i], prb[i]);
    }

    build(1, md + 1, ri);

    f = 1e9, g = 1e9;
    r = md + 1;
    r1 = md + 1;

    for (int l = md; l >= le; l--) {
        f = min(f, a[l]);
        g = min(g, b[l]);

        while (r <= ri && g <= pra[r])
            r++;

        while (r1 <= ri && f < prb[r1])
            r1++;

        if (r1 <= r - 1) {
            ll cur = get(1, md + 1, ri, r1, r - 1, l);

            if (cur != -1e18) {
                upd_a(g * 1ll * cur);
            }
        }
    }

    //806801766313992
    //1675888823757

    solve(le, md - 1);
    solve(md + 1, ri);
}

int main()
{
//    mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());;
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//	in("game.in");
//	out("game.out");
//    in("input.txt");
//    out("output.txt");

//    clock_t tStart = clock();

    cin >> n;

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

    solve(1, n);

    cout << ans;
}


/*

7
4 6 7 2 3 1 5
*/

Compilation message

histogram.cpp: In function 'void solve(int, int)':
histogram.cpp:138:24: error: no matching function for call to 'min(int&, ll&)'
  138 |         f = min(f, a[l]);
      |                        ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from histogram.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
histogram.cpp:138:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
  138 |         f = min(f, a[l]);
      |                        ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from histogram.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
histogram.cpp:138:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
  138 |         f = min(f, a[l]);
      |                        ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from histogram.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
histogram.cpp:138:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
  138 |         f = min(f, a[l]);
      |                        ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from histogram.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
histogram.cpp:138:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
  138 |         f = min(f, a[l]);
      |                        ^
histogram.cpp:139:24: error: no matching function for call to 'min(int&, ll&)'
  139 |         g = min(g, b[l]);
      |                        ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from histogram.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
histogram.cpp:139:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
  139 |         g = min(g, b[l]);
      |                        ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from histogram.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
histogram.cpp:139:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
  139 |         g = min(g, b[l]);
      |                        ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from histogram.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
histogram.cpp:139:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
  139 |         g = min(g, b[l]);
      |                        ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from histogram.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
histogram.cpp:139:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
  139 |         g = min(g, b[l]);
      |                        ^
histogram.cpp:158:24: error: no matching function for call to 'min(int&, ll&)'
  158 |         f = min(f, a[r]);
      |                        ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from histogram.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
histogram.cpp:158:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
  158 |         f = min(f, a[r]);
      |                        ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from histogram.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
histogram.cpp:158:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
  158 |         f = min(f, a[r]);
      |                        ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from histogram.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
histogram.cpp:158:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
  158 |         f = min(f, a[r]);
      |                        ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from histogram.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
histogram.cpp:158:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
  158 |         f = min(f, a[r]);
      |                        ^
histogram.cpp:159:24: error: no matching function for call to 'min(int&, ll&)'
  159 |         g = min(g, b[r]);
      |                        ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from histogram.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
histogram.cpp:159:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
  159 |         g = min(g, b[r]);
      |                        ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from histogram.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
histogram.cpp:159:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
  159 |         g = min(g, b[r]);
      |                        ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from histogram.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
histogram.cpp:159:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
  159 |         g = min(g, b[r]);
      |                        ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from histogram.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
histogram.cpp:159:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
  159 |         g = min(g, b[r]);
      |                        ^
histogram.cpp:177:24: error: no matching function for call to 'min(int&, ll&)'
  177 |         f = min(f, a[l]);
      |                        ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from histogram.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
histogram.cpp:177:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
  177 |         f = min(f, a[l]);
      |                        ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from histogram.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
histogram.cpp:177:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
  177 |         f = min(f, a[l]);
      |                        ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from histogram.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
histogram.cpp:177:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
  177 |         f = min(f, a[l]);
      |                        ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from histogram.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
histogram.cpp:177:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
  177 |         f = min(f, a[l]);
      |                        ^
histogram.cpp:178:24: error: no matching function for call to 'min(int&, ll&)'
  178 |         g = min(g, b[l]);
      |                        ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from histogram.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
histogram.cpp:178:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
  178 |         g = min(g, b[l]);
      |                        ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from histogram.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits