답안 #609683

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
609683 2022-07-27T19:16:11 Z Tigerpants 사탕 분배 (IOI21_candies) C++17
컴파일 오류
0 ms 0 KB
//#include <iostream>
#include "candies.h"
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>

using namespace std;

typedef long long int ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pi;
typedef tuple<ll, ll, ll> t3i;
typedef tuple<ll, ll, ll, ll> t4i;
typedef tuple<ll, ll, ll, ll, ll> t5i;
typedef vector<pi> vpi;
typedef vector<t3i> vt3i;
typedef vector<t4i> vt4i;
typedef vector<t5i> vt5i;

ll inf = 1000000000000000;
vi none = {-inf, 0, inf, 0, 0};

vvi segtree_M; // max val, max index, min val, min index, update
vpi segtree_M_span; // left, right

// bug: segment tree should be sorted by time, and affect a time-period

void print_tree(ll x) {
    //cout << x << ": " << segtree_M[x][0] << " " << segtree_M[x][1] << " " << segtree_M[x][2] << " " << segtree_M[x][3] << " " << segtree_M[x][4] << endl;
    if (segtree_M_span[x].first != segtree_M_span[x].second) {
        print_tree(2 * x);
        print_tree(2 * x + 1);
    }
}

vi combine(vi a, vi b) { // if they are equal, second parameter gets dips on index
    vi result(5);
    if (a[0] > b[0]) {
        if (a[2] < b[2]) {
            result = {a[0], a[1], a[2], a[3], 0};
        } else {
            result = {a[0], a[1], b[2], b[3], 0};
        }
    } else {
        if (a[2] < b[2]) {
            result = {b[0], b[1], a[2], a[3], 0};
        } else {
            result = {b[0], b[1], b[2], b[3], 0};
        }
    }
    return result;
}

void build(ll x, ll l, ll r) {
    segtree_M_span[x] = make_pair(l, r);
    segtree_M[x] = {0, l, 0, l, 0};

    if (l == r) {
        return;
    }

    ll mid = (l + r) / 2;

    build(2 * x, l, mid);
    build(2 * x + 1, mid + 1, r);
}

void lazy_propagation(ll x) {
    // lazy propagation for guaranteed O(log n) for updates
    // check if node has children, if so propagate down...
    if (segtree_M_span[x].first != segtree_M_span[x].second) {
        // left child
        segtree_M[2 * x][0] += segtree_M[x][4];
        segtree_M[2 * x][2] += segtree_M[x][4];
        segtree_M[2 * x][4] += segtree_M[x][4];
        // right child
        segtree_M[2 * x + 1][0] += segtree_M[x][4];
        segtree_M[2 * x + 1][2] += segtree_M[x][4];
        segtree_M[2 * x + 1][4] += segtree_M[x][4];
    }
    segtree_M[x][4] = 0;
}

void update(ll x, ll l, ll r, ll v) { // range update add v to elements of [l, r]
    lazy_propagation(x);

    if ((segtree_M_span[x].first > r) || (segtree_M_span[x].second < l)) {
        return;
    }
    if ((segtree_M_span[x].first >= l) && (segtree_M_span[x].second <= r)) {
        //cout << segtree_M_span[x].first << " " << segtree_M_span[x].second << " : " << v << endl;
        segtree_M[x][0] += v;
        segtree_M[x][2] += v;
        segtree_M[x][4] += v;
        return;
    }
    update(2 * x, l, r, v);
    update(2 * x + 1, l, r, v);
    segtree_M[x] = combine(segtree_M[2 * x], segtree_M[2 * x + 1]);
}

vi query(ll x, ll l, ll r) {
    lazy_propagation(x);

    if ((segtree_M_span[x].first > r) || (segtree_M_span[x].second < l)) {
        return none;
    }
    if ((segtree_M_span[x].first >= l) && (segtree_M_span[x].second <= r)) {
        return segtree_M[x];
    }

    return combine(query(2 * x, l, r), query(2 * x + 1, l, r));
}

std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> l, std::vector<int> r, std::vector<int> v) {
    ll n = c.size();
    ll q = l.size(); // size of r and v too

    std::vector<int> result(n);

    vvi queries1(q, vi(4)); // use get<2>(queries[i]) and queries[i] = make_tuple(..., ..., ...)
    vvi queries2(q, vi(4));
    for (ll i = 0; i < q; i++) {
        queries1[i] = {(ll)l[i], (ll)r[i], (ll)v[i], i + 2};
        queries2[i] = {(ll)r[i], (ll)l[i], (ll)v[i], i + 2};
    }

    sort(queries1.begin(), queries1.end());
    sort(queries2.begin(), queries2.end());

    //cout << "sorted" << endl;

    segtree_M.resize(4 * q + 8);
    segtree_M_span.resize(4 * q + 8);
    build(1, 0, q + 1);
    update(1, 0, 0, inf);

    //print_tree(1);
    //cout << "built" << endl;

    vvi::iterator itr1 = queries1.begin(); // activation ptr
    vvi::iterator itr2 = queries2.begin(); // deactivation ptr

    for (int i = 0; i < n; i++) {
        //cout << i << "/" << n << endl;
        // activate queries
        if (itr1 != queries1.end()) {
            while (get<0>(*itr1) <= i) {
                update(1, get<3>(*itr1), q + 1, get<2>(*itr1));
                //cout << get<0>(*itr1) << " " << get<1>(*itr1) << " " << get<2>(*itr1) << " " << get<3>(*itr1) << endl;
                //print_tree(1);
                itr1++;
                if (itr1 == queries1.end()) {
                    break;
                }
            }
        }
        //cout << "activated" << endl;
        // deactivate queries
        if (itr2 != queries2.end()) {
            while (get<0>(*itr2) < i) {
                update(1, get<3>(*itr2), q + 1, -get<2>(*itr2));
                //cout << get<1>(*itr2) << " " << get<0>(*itr2) << " " << get<2>(*itr2) << " " << get<3>(*itr2) << endl;
                itr2++;
                if (itr2 == queries2.end()) {
                    break;
                }
            }
        }
        //cout << "deactivated" << endl;
        //print_tree(1);
        //cout << "printed tree" << endl;
        // binary search for max - min ≈ c[i]
        ll minj = 0;
        ll maxj = q + 2;
        // store end result outside scope for finishing calculations
        vi q_res;
        while (minj + 1 < maxj) {
            ll midj = (minj + maxj) / 2;
            q_res = query(1, midj, q + 1);
            //cout << minj << " " << maxj << " " << midj << endl;
            //cout << q_res[0] << " " << q_res[1] << " " << q_res[2] << " " << q_res[3] << " " << q_res[4] << endl;
            if (q_res[0] - q_res[2] < (ll)c[i]) {
                maxj = midj;
            } else {
                minj = midj;
            }
        }
        q_res = query(1, minj, q + 1);
        //cout << minj << endl;
        //cout << q_res[0] << " " << q_res[1] << " " << q_res[2] << " " << q_res[3] << " " << q_res[4] << endl;
        //cout << "found result" << endl;
        // calculate result
        if (q_res[1] > q_res[3]) {
            // use q_res[1] as reference
            result[i] = c[i] + (int)(query(1, q + 1, q + 1)[0] - q_res[0]);
        } else {
            // use q_res[3] as reference
            result[i] = (int)(query(1, q + 1, q + 1)[0] - q_res[2]);
        }
        //cout << "calculated result: " << result[i] << endl;
    }

    return result;
}

/*
int main() {
    vi c = {10, 15, 13};
    vi l = {0, 0};
    vi r = {2, 1};
    vi v = {20, -11};
    vi result = distribute_candies(c, l, r, v);
    for (ll i = 0; i < result.size(); i++) {
        cout << result[i] << " ";
    }
    cout << endl;
    return 0;
}
*/

Compilation message

candies.cpp: In function 'std::vector<int> distribute_candies(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
candies.cpp:153:32: error: no matching function for call to 'get<0>(std::vector<long long int>&)'
  153 |             while (get<0>(*itr1) <= i) {
      |                                ^
In file included from /usr/include/c++/10/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from candies.cpp:3:
/usr/include/c++/10/utility:223:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(std::pair<_Tp1, _Tp2>&)'
  223 |     get(std::pair<_Tp1, _Tp2>& __in) noexcept
      |     ^~~
/usr/include/c++/10/utility:223:5: note:   template argument deduction/substitution failed:
candies.cpp:153:32: note:   'std::vector<long long int>' is not derived from 'std::pair<_Tp1, _Tp2>'
  153 |             while (get<0>(*itr1) <= i) {
      |                                ^
In file included from /usr/include/c++/10/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from candies.cpp:3:
/usr/include/c++/10/utility:228:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(std::pair<_Tp1, _Tp2>&&)'
  228 |     get(std::pair<_Tp1, _Tp2>&& __in) noexcept
      |     ^~~
/usr/include/c++/10/utility:228:5: note:   template argument deduction/substitution failed:
candies.cpp:153:32: note:   'std::vector<long long int>' is not derived from 'std::pair<_Tp1, _Tp2>'
  153 |             while (get<0>(*itr1) <= i) {
      |                                ^
In file included from /usr/include/c++/10/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from candies.cpp:3:
/usr/include/c++/10/utility:233:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(const std::pair<_Tp1, _Tp2>&)'
  233 |     get(const std::pair<_Tp1, _Tp2>& __in) noexcept
      |     ^~~
/usr/include/c++/10/utility:233:5: note:   template argument deduction/substitution failed:
candies.cpp:153:32: note:   'std::vector<long long int>' is not derived from 'const std::pair<_Tp1, _Tp2>'
  153 |             while (get<0>(*itr1) <= i) {
      |                                ^
In file included from /usr/include/c++/10/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from candies.cpp:3:
/usr/include/c++/10/utility:238:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(const std::pair<_Tp1, _Tp2>&&)'
  238 |     get(const std::pair<_Tp1, _Tp2>&& __in) noexcept
      |     ^~~
/usr/include/c++/10/utility:238:5: note:   template argument deduction/substitution failed:
candies.cpp:153:32: note:   'std::vector<long long int>' is not derived from 'const std::pair<_Tp1, _Tp2>'
  153 |             while (get<0>(*itr1) <= i) {
      |                                ^
In file included from /usr/include/c++/10/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from candies.cpp:3:
/usr/include/c++/10/utility:247:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp& std::get(std::pair<_T1, _T2>&)'
  247 |     get(pair<_Tp, _Up>& __p) noexcept
      |     ^~~
/usr/include/c++/10/utility:247:5: note:   template argument deduction/substitution failed:
/usr/include/c++/10/utility:252:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp& std::get(const std::pair<_T1, _T2>&)'
  252 |     get(const pair<_Tp, _Up>& __p) noexcept
      |     ^~~
/usr/include/c++/10/utility:252:5: note:   template argument deduction/substitution failed:
/usr/include/c++/10/utility:257:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp&& std::get(std::pair<_T1, _T2>&&)'
  257 |     get(pair<_Tp, _Up>&& __p) noexcept
      |     ^~~
/usr/include/c++/10/utility:257:5: note:   template argument deduction/substitution failed:
/usr/include/c++/10/utility:262:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp&& std::get(const std::pair<_T1, _T2>&&)'
  262 |     get(const pair<_Tp, _Up>&& __p) noexcept
      |     ^~~
/usr/include/c++/10/utility:262:5: note:   template argument deduction/substitution failed:
/usr/include/c++/10/utility:267:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp& std::get(std::pair<_Up, _Tp>&)'
  267 |     get(pair<_Up, _Tp>& __p) noexcept
      |     ^~~
/usr/include/c++/10/utility:267:5: note:   template argument deduction/substitution failed:
/usr/include/c++/10/utility:272:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp& std::get(const std::pair<_Up, _Tp>&)'
  272 |     get(const pair<_Up, _Tp>& __p) noexcept
      |     ^~~
/usr/include/c++/10/utility:272:5: note:   template argument deduction/substitution failed:
/usr/include/c++/10/utility:277:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp&& std::get(std::pair<_Up, _Tp>&&)'
  277 |     get(pair<_Up, _Tp>&& __p) noexcept
      |     ^~~
/usr/include/c++/10/utility:277:5: note:   template argument deduction/substitution failed:
/usr/include/c++/10/utility:282:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp&& std::get(const std::pair<_Up, _Tp>&&)'
  282 |     get(const pair<_Up, _Tp>&& __p) noexcept
      |     ^~~
/usr/include/c++/10/utility:282:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/10/tuple:39,
                 from /usr/include/c++/10/functional:54,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from candies.cpp:3:
/usr/include/c++/10/array:334:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp& std::get(std::array<_Tp, _Nm>&)'
  334 |     get(array<_Tp, _Nm>& __arr) noexcept
      |     ^~~
/usr/include/c++/10/array:334:5: note:   template argument deduction/substitution failed:
candies.cpp:153:32: note:   'std::vector<long long int>' is not derived from 'std::array<_Tp, _Nm>'
  153 |             while (get<0>(*itr1) <= i) {
      |                                ^
In file included from /usr/include/c++/10/tuple:39,
                 from /usr/include/c++/10/functional:54,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from candies.cpp:3:
/usr/include/c++/10/array:343:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp&& std::get(std::array<_Tp, _Nm>&&)'
  343 |     get(array<_Tp, _Nm>&& __arr) noexcept
      |     ^~~
/usr/include/c++/10/array:343:5: note:   template argument deduction/substitution failed:
candies.cpp:153:32: note:   'std::vector<long long int>' is not derived from 'std::array<_Tp, _Nm>'
  153 |             while (get<0>(*itr1) <= i) {
      |                                ^
In file included from /usr/include/c++/10/tuple:39,
                 from /usr/include/c++/10/functional:54,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from candies.cpp:3:
/usr/include/c++/10/array:351:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp& std::get(const std::array<_Tp, _Nm>&)'
  351 |     get(const array<_Tp, _Nm>& __arr) noexcept
      |     ^~~
/usr/include/c++/10/array:351:5: note:   template argument deduction/substitution failed:
candies.cpp:153:32: note:   'std::vector<long long int>' is not derived from 'const std::array<_Tp, _Nm>'
  153 |             while (get<0>(*itr1) <= i) {
      |                                ^
In file included from /usr/include/c++/10/tuple:39,
                 from /usr/include/c++/10/functional:54,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from candies.cpp:3:
/usr/include/c++/10/array:360:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp&& std::get(const std::array<_Tp, _Nm>&&)'
  360 |     get(const array<_Tp, _Nm>&& __arr) noexcept
      |     ^~~
/usr/include/c++/10/array:360:5: note:   template argument deduction/substitution failed:
candies.cpp:153:32: note:   'std::vector<long long int>' is not derived from 'const std::array<_Tp, _Nm>'
  153 |             while (get<0>(*itr1) <= i) {
      |                                ^
In file included from /usr/include/c++/10/functional:54,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from candies.cpp:3:
/usr/include/c++/10/tuple:1294:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_UTypes ...> >& std::get(std::tuple<_UTypes ...>&)'
 1294 |     get(tuple<_Elements...>& __t) noexcept
      |     ^~~
/usr/include/c++/10/tuple:1294:5: note:   template argument deduction/substitution failed:
candies.cpp:153:32: note:   'std::vector<long long int>' is not derived from 'std::tuple<_UTypes ...>'
  153 |             while (get<0>(*itr1) <= i) {
      |                                ^
In file included from /usr/include/c++/10/functional:54,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from candies.cpp:3:
/usr/include/c++/10/tuple:1300:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_UTypes ...> >& std::get(const std::tuple<_UTypes ...>&)'
 1300 |     get(const tuple<_Elements...>& __t) noexcept
      |     ^~~
/usr/include/c++/10/tuple:1300:5: note:   template argument deduction/substitution failed:
candies.cpp:153:32: note:   'std::vector<long long int>' is not derived from 'const std::tuple<_UTypes ...>'
  153 |             while (get<0>(*itr1) <= i) {
      |                                ^
In file included from /usr/include/c++/10/functional:54,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from candies.cpp:3:
/usr/include/c++/10/tuple:1306:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_UTypes ...> >&& std::get(std::tuple<_UTypes ...>&&)'
 1306 |     get(tuple<_Elements...>&& __t) noexcept
      |     ^~~
/usr/include/c++/10/tuple:1306:5: note:   template argument deduction/substitution failed:
candies.cpp:153:32: note:   'std::vector<long long int>' is not derived from 'std::tuple<_UTypes ...>'
  153 |             while (get<0>(*itr1) <= i) {
      |                                ^
In file included from /usr/include/c++/10/functional:54,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from candies.cpp:3:
/usr/include/c++/10/tuple:1315:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_UTypes ...> >&& std::get(const std::tuple<_UTypes ...>&&)'
 1315 |     get(const tuple<_Elements...>&& __t) noexcept
      |     ^~~
/usr/include/c++/10/tuple:1315:5: note:   template argument deduction/substitution failed:
candies.cpp:153:32: note:   'std::vector<long long int>' is not derived from 'const std::tuple<_UTypes ...>'
  153 |             while (get<0>(*itr1) <= i) {
      |                                ^
In file included from /usr/include/c++/10/functional:54,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from candies.cpp:3:
/usr/include/c++/10/tuple:1338:5: note: candidate: 'template<class _Tp, class ... _Types> constexpr _Tp& std::get(std::tuple<_UTypes ...>&)'
 1338 |     get(tuple<_Types...>& __t) noexcept
      |     ^~~
/usr/include/c++/10/tuple:1338:5: note:   template argument deduction/substitution failed:
/usr/include/c++/10/tuple:1344:5: note: candidate: 'template<class _Tp, class ... _Types> constexpr _Tp&& std::get(std::tuple<_UTypes ...>&&)'
 1344 |     get(tuple<_Types...>&& __t) noexcept
      |     ^~~
/usr/include/c++/10/tuple:1344:5: note:   template argument deduction/substitution failed:
/usr/include/c++/10/tuple:1350:5: note: candidate: 'template<class _Tp, class ... _Types> constexpr const _Tp& std::get(const std::tuple<_UTypes ...>&)'
 1350 |     get(const tuple<_Types...>& __t) noexcept
      |     ^~~
/usr/include/c++/10/tuple:1350:5: note:   template argument deduction/substitution failed:
/usr/include/c++/10/tuple:1357:5: note: candidate: 'template<class _Tp, class ... _Types> constexpr const _Tp&& std::get(const std::tuple<_UTypes ...>&&)'
 1357 |     get(const tuple<_Types...>&& __t) noexcept
      |     ^~~
/usr/include/c++/10/tuple:1357:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
                 from candies.cpp:3:
/usr/include/c++/10/variant:1644:5: note: candidate: 'template<long unsigned int _Np, class ... _Types> constexpr std::variant_alternative_t<_Np, std::variant<_Types ...> >& std::get(std::variant<_Types ...>&)'
 1644 |     get(variant<_Types...>& __v)
      |     ^~~
/usr/include/c++/10/variant:1644:5: note:   template argument deduction/substitution failed:
candies.cpp:153:32: note:   'std::vector<long long int>' is not derived from 'std::variant<_Types ...>'
  153 |             while (get<0>(*itr1) <= i) {
      |                                ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
                 from candies.cpp:3:
/usr/include/c++/10/variant:1655:5: note: candidate: 'template<long unsigned int _Np, class ... _Types> constexpr std::variant_alternative_t<_Np, std::variant<_Types ...> >&& std::get(std::variant<_Types ...>&&)'
 1655 |     get(variant<_Types...>&& __v)
      |     ^~~
/usr/include/c++/10/variant:1655:5: note:   template argument deduction/substitution failed:
candies.cpp:153:32: note:   'std::vector<long long int>' is not derived from 'std::variant<_Types ...>'
  153 |             while (get<0>(*itr1) <= i) {
      |                                ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
                 from candies.cpp:3:
/usr/include/c++/10/variant:1666:5: note: candidate: 'template<long unsigned int _Np, class ... _Types> constexpr std::variant_alternative_t<_Np, std::variant<_Types ...> >& std::get(const std::variant<_Types ...>&)'
 1666 |     get(const variant<_Types...>& __v)
      |     ^~~
/usr/include/c++/10/variant:1666:5: note:   template argument deduction/substitution failed:
candies.cpp:153:32: note:   'std::vector<long long int>' is not derived from 'const std::variant<_Types ...>'
  153 |             while (get<0>(*itr1) <= i) {
      |                                ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
                 from candies.cpp:3:
/usr/include/c++/10/variant:1677:5: note: candidate: 'template<long unsigned int _Np, class ... _Types> constexpr std::variant_alternative_t<_Np, std::variant<_Types ...> >&& std::get(const std::variant<_Types ...>&&)'
 1677 |     get(const variant<_Types...>&& __v)
      |     ^~~
/usr/include/c++/10/variant:1677:5: note:   template argument deduction/substitution failed:
candies.cpp:153:32: note:   'std::vector<long long int>' is not derived from 'const std::variant<_Types ...>'
  153 |             while (get<0>(*itr1) <= i) {
      |                                ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:133,
                 from candies.cpp:3:
/usr/include/c++/10/variant:1071:20: note: candidate: 'template<class _Tp, class ... _Types> constexpr _Tp& std::get(std::variant<_Types ...>&)'
 1071 |     constexpr _Tp& get(variant<_Types...>& __v)
      |                    ^~~
/usr/include/c++/10/variant:1071:20: note:   template argument deduction/substitution failed:
/usr/include/c++/10/variant:1080:21: note: candidate: 'template<class _Tp, class ... _Types> constexpr _Tp&& std::get(std::variant<_Types ...>&&)'
 1080 |     constexpr _Tp&& get(variant<_Types...>&& __v)
      |                     ^~~
/usr/include/c++/10/variant:1080:21: note:   template argument deduction/substitution failed:
/usr/include/c++/10/variant:1090:26: note: candidate: 'template<class _Tp, class ... _Types> constexpr const _Tp& std::get(const std::variant<_Types ...>&)'
 1090 |     constexpr const _Tp& get(const variant<_Types...>& __v)
      |                          ^~~
/usr/include/c++/10/variant:1090:26: note:   template argument deduction/substitution failed:
/usr/include/c++/10/variant:1099:27: note: candidate: 'template<class _Tp, class ... _Types> constexpr const _Tp&& std::get(const std::variant<_Types ...>&&)'
 1099 |     constexpr const _Tp&& get(const variant<_Types...>&& __v)
      |                           ^~~
/usr/include/c++/10/variant:1099:27: note:   template argument deduction/substitution failed:
candies.cpp:154:39: error: no matching function for call to 'get<3>(std::vector<long long int>&)'
  154 |                 update(1, get<3>(*itr1), q + 1, get<2>(*itr1));
      |                                       ^
In file included from /usr/include/c++/10/algorithm:60,
                 from /usr/incl