Submission #991044

#TimeUsernameProblemLanguageResultExecution timeMemory
991044SharkySeats (IOI18_seats)C++17
Compilation error
0 ms0 KiB
#include "seats.h"
#include <bits/stdc++.h>
using namespace std;

#define i32 int32_t

void give_initial_chart(i32 H, i32 W, vector<i32> R, vector<i32> C);
i32 swap_seats(i32 a, i32 b);

struct Node {
    int val, freq;
    Node operator + (Node& o) {
        if (val == o.val) return {val, freq + o.freq};
        if (val < o.val) return {val, freq};
        if (val > o.val) return {o.val, o.freq};
    }
};

struct SegTree {
    int size = 1;
    vector<Node> seg;
    vector<int> lazy;
    void init(int n) {
        while (size < n) size *= 2;
        seg.resize(2 * size + 10);
        lazy.assign(2 * size + 10, 0);
    }
    void build(int l, int r, int id) {
        if (l == r) {
            seg[id] = {1e9, 1};
            return;
        }
        int mid = (l + r) / 2;
        build(l, mid, id * 2);
        build(mid + 1, r, id * 2 + 1);
        seg[id] = seg[id * 2] + seg[id * 2 + 1];
    }
    void push(int id) {
        seg[id].val += lazy[id];
        if (id < size) {
            for (int i = 0; i < 2; i++) {
                lazy[id * 2 + i] += lazy[id];
            }
        }
        lazy[id] = 0;
    }
    void update(int ql, int qr, int tos, int l, int r, int id) {
        push(id);
        if (ql <= l && r <= qr) {
            lazy[id] += tos;
            push(id);
            return;
        }
        int mid = (l + r) / 2;
        update(ql, qr, tos, l, mid, id * 2);
        update(ql, qr, tos, mid + 1, r, id * 2 + 1);
        seg[id] = seg[id * 2] + seg[id * 2 + 1];
    }
    int query() {
        return seg[1].val == 4 ? seg[1].freq : 0;
    }
} st;

int n, h, w;
vector<int> rr, cc;
vector<vector<int>> g;

int I(int i, int j) {
    return i * w + j + 1;
}

void give_initial_chart(i32 H, i32 W, vector<i32> R, vector<i32> C) {
    h = H, w = W, n = h * w;
    st.init(n + 1);
    g = vector<vector<int>> (h + 2, vector<int> (w + 2, 0));
    rr.resize(n), cc.resize(n);
    for (int i = 0; i < n; i++) {
        g[R[i] + 1][C[i] + 1] = i;
        rr[i] = R[i] + 1, cc[i] = C[i] + 1;
    }
    for (int i = 0; i <= h; i++) {
        for (int j = 0; j <= w; j++) {
            vector<tuple<int, int, int>> tmp;
            tmp.push_back({g[i][j], i, j});
            tmp.push_back({g[i][j + 1], i, j + 1});
            tmp.push_back({g[i + 1][j], i + 1, j});
            tmp.push_back({g[i + 1][j + 1], i + 1, j + 1});
            sort(tmp.begin(), tmp.end());
            st.upd(tmp[0], tmp[1] - 1, 1, 1, n, 1);
            st.upd(tmp[2], tmp[3] - 1, 1e9, 1, n, 1);
        }
    }
}

i32 swap_seats(i32 a, i32 b) {
    vector<pair<int, int>> e;
    for (int i = 0; i <= 1; i++) for (int j = 0; j <= 1; j++) {
        e.push_back({rr[a] - i, cc[a] - j});
        e.push_back({rr[b] - i, cc[b] - j});
    }
    sort(e.begin(), e.end());
    e.erase(unique(e.begin(), e.end()), e.end());
    for (auto& [i, j] : e) {
        vector<tuple<int, int, int>> tmp;
        tmp.push_back({g[i][j], i, j});
        tmp.push_back({g[i][j + 1], i, j + 1});
        tmp.push_back({g[i + 1][j], i + 1, j});
        tmp.push_back({g[i + 1][j + 1], i + 1, j + 1});
        sort(tmp.begin(), tmp.end());
        st.upd(tmp[0], tmp[1] - 1, -1, 1, n, 1);
        st.upd(tmp[2], tmp[3] - 1, -1e9, 1, n, 1);
    }
    swap(rr[a], rr[b]);
    swap(cc[a], cc[b]);
    swap(g[rr[a]][cc[a]], g[rr[b]][cc[b]]);
    for (auto& [i, j] : e) {
        vector<tuple<int, int, int>> tmp;
        tmp.push_back({g[i][j], i, j});
        tmp.push_back({g[i][j + 1], i, j + 1});
        tmp.push_back({g[i + 1][j], i + 1, j});
        tmp.push_back({g[i + 1][j + 1], i + 1, j + 1});
        sort(tmp.begin(), tmp.end());
        st.upd(tmp[0], tmp[1] - 1, 1, 1, n, 1);
        st.upd(tmp[2], tmp[3] - 1, 1e9, 1, n, 1);
    }
    i32 ans = st.query();
    return ans;
}

Compilation message (stderr)

seats.cpp: In member function 'void SegTree::build(int, int, int)':
seats.cpp:30:30: error: narrowing conversion of '1.0e+9' from 'double' to 'int' [-Wnarrowing]
   30 |             seg[id] = {1e9, 1};
      |                              ^
seats.cpp: In function 'void give_initial_chart(int32_t, int32_t, std::vector<int>, std::vector<int>)':
seats.cpp:89:16: error: 'struct SegTree' has no member named 'upd'
   89 |             st.upd(tmp[0], tmp[1] - 1, 1, 1, n, 1);
      |                ^~~
seats.cpp:89:35: error: no match for 'operator-' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<int, int, int> >, std::tuple<int, int, int> >::value_type' {aka 'std::tuple<int, int, int>'} and 'int')
   89 |             st.upd(tmp[0], tmp[1] - 1, 1, 1, n, 1);
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from seats.h:3,
                 from seats.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)'
  500 |     operator-(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:500:5: note:   template argument deduction/substitution failed:
seats.cpp:89:37: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<int, int, int> >, std::tuple<int, int, int> >::value_type' {aka 'std::tuple<int, int, int>'} is not derived from 'const std::reverse_iterator<_Iterator>'
   89 |             st.upd(tmp[0], tmp[1] - 1, 1, 1, n, 1);
      |                                     ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from seats.h:3,
                 from seats.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1533:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&)'
 1533 |     operator-(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1533:5: note:   template argument deduction/substitution failed:
seats.cpp:89:37: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<int, int, int> >, std::tuple<int, int, int> >::value_type' {aka 'std::tuple<int, int, int>'} is not derived from 'const std::move_iterator<_IteratorL>'
   89 |             st.upd(tmp[0], tmp[1] - 1, 1, 1, n, 1);
      |                                     ^
In file included from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from seats.cpp:2:
/usr/include/c++/10/complex:361:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const std::complex<_Tp>&, const std::complex<_Tp>&)'
  361 |     operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)
      |     ^~~~~~~~
/usr/include/c++/10/complex:361:5: note:   template argument deduction/substitution failed:
seats.cpp:89:37: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<int, int, int> >, std::tuple<int, int, int> >::value_type' {aka 'std::tuple<int, int, int>'} is not derived from 'const std::complex<_Tp>'
   89 |             st.upd(tmp[0], tmp[1] - 1, 1, 1, n, 1);
      |                                     ^
In file included from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from seats.cpp:2:
/usr/include/c++/10/complex:370:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const std::complex<_Tp>&, const _Tp&)'
  370 |     operator-(const complex<_Tp>& __x, const _Tp& __y)
      |     ^~~~~~~~
/usr/include/c++/10/complex:370:5: note:   template argument deduction/substitution failed:
seats.cpp:89:37: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<int, int, int> >, std::tuple<int, int, int> >::value_type' {aka 'std::tuple<int, int, int>'} is not derived from 'const std::complex<_Tp>'
   89 |             st.upd(tmp[0], tmp[1] - 1, 1, 1, n, 1);
      |                                     ^
In file included from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from seats.cpp:2:
/usr/include/c++/10/complex:379:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const _Tp&, const std::complex<_Tp>&)'
  379 |     operator-(const _Tp& __x, const complex<_Tp>& __y)
      |     ^~~~~~~~
/usr/include/c++/10/complex:379:5: note:   template argument deduction/substitution failed:
seats.cpp:89:37: note:   mismatched types 'const std::complex<_Tp>' and 'int'
   89 |             st.upd(tmp[0], tmp[1] - 1, 1, 1, n, 1);
      |                                     ^
In file included from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from seats.cpp:2:
/usr/include/c++/10/complex:456:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const std::complex<_Tp>&)'
  456 |     operator-(const complex<_Tp>& __x)
      |     ^~~~~~~~
/usr/include/c++/10/complex:456:5: note:   template argument deduction/substitution failed:
seats.cpp:89:37: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<int, int, int> >, std::tuple<int, int, int> >::value_type' {aka 'std::tuple<int, int, int>'} is not derived from 'const std::complex<_Tp>'
   89 |             st.upd(tmp[0], tmp[1] - 1, 1, 1, n, 1);
      |                                     ^
In file included from /usr/include/c++/10/valarray:603,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from seats.cpp:2:
/usr/include/c++/10/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::_Expr<_Dom2, typename _Dom2::value_type>&)'
  406 |     _DEFINE_EXPR_BINARY_OPERATOR(-, __minus)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/valarray_after.h:406:5: note:   template argument deduction/substitution failed:
seats.cpp:89:37: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<int, int, int> >, std::tuple<int, int, int> >::value_type' {aka 'std::tuple<int, int, int>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
   89 |             st.upd(tmp[0], tmp[1] - 1, 1, 1, n, 1);
      |                                     ^
In file included from /usr/include/c++/10/valarray:603,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from seats.cpp:2:
/usr/include/c++/10/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
  406 |     _DEFINE_EXPR_BINARY_OPERATOR(-, __minus)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/valarray_after.h:406:5: note:   template argument deduction/substitution failed:
seats.cpp:89:37: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<int, int, int> >, std::tuple<int, int, int> >::value_type' {aka 'std::tuple<int, int, int>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
   89 |             st.upd(tmp[0], tmp[1] - 1, 1, 1, n, 1);
      |                                     ^
In file included from /usr/include/c++/10/valarray:603,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from seats.cpp:2:
/usr/include/c++/10/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)'
  406 |     _DEFINE_EXPR_BINARY_OPERATOR(-, __minus)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/valarray_after.h:406:5: note:   template argument deduction/substitution failed:
seats.cpp:89:37: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
   89 |             st.upd(tmp[0], tmp[1] - 1, 1, 1, n, 1);
      |                                     ^
In file included from /usr/include/c++/10/valarray:603,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from seats.cpp:2:
/usr/include/c++/10/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::valarray<typename _Dom::value_type>&)'
  406 |     _DEFINE_EXPR_BINARY_OPERATOR(-, __minus)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/valarray_after.h:406:5: note:   template argument deduction/substitution failed:
seats.cpp:89:37: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<int, int, int> >, std::tuple<int, int, int> >::value_type' {aka 'std::tuple<int, int, int>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
   89 |             st.upd(tmp[0], tmp[1] - 1, 1, 1, n, 1);
      |                                     ^
In file included from /usr/include/c++/10/valarray:603,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from seats.cpp:2:
/usr/include/c++/10/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const std::valarray<typename _Dom::value_type>&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)'
  406 |     _DEFINE_EXPR_BINARY_OPERATOR(-, __minus)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/valarray_after.h:406:5: note:   template argument deduction/substitution failed:
seats.cpp:89:37: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
   89 |             st.upd(tmp[0], tmp[1] - 1, 1, 1, n, 1);
      |                                     ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from seats.cpp:2:
/usr/include/c++/10/valarray:1186:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const std::valarray<_Tp>&, const std::valarray<_Tp>&)'
 1186 | _DEFINE_BINARY_OPERATOR(-, __minus)
      | ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/valarray:1186:1: note:   template argument deduction/substitution failed:
seats.cpp:89:37: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<int, int, int> >, std::tuple<int, int, int> >::value_type' {aka 'std::tuple<int, int, int>'} is not derived from 'const std::valarray<_Tp>'
   89 |             st.upd(tmp[0], tmp[1] - 1, 1, 1, n, 1);
      |                                     ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from seats.cpp:2:
/usr/include/c++/10/valarray:1186:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const std::valarray<_Tp>&, const typename std::valarray<_Tp>::value_type&)'
 1186 | _DEFINE_BINARY_OPERATOR(-, __minus)
      | ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/valarray:1186:1: note:   template argument deduction/substitution failed:
seats.cpp:89:37: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<int, int, int> >, std::tuple<int, int, int> >::value_type' {aka 'std::tuple<int, int, int>'} is not derived from 'const std::valarray<_Tp>'
   89 |             st.upd(tmp[0], tmp[1] - 1, 1, 1, n, 1);
      |                                     ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from seats.cpp:2:
/usr/include/c++/10/valarray:1186:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const typename std::valarray<_Tp>::value_type&, const std::valarray<_Tp>&)'
 1186 | _DEFINE_BINARY_OPERATOR(-, __minus)
      | ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/valarray:1186:1: note:   template argument deduction/substitution failed:
seats.cpp:89:37: note:   mismatched types 'const std::valarray<_Tp>' and 'int'
   89 |             st.upd(tmp[0], tmp[1] - 1, 1, 1, n, 1);
      |                                     ^
seats.cpp:90:16: error: 'struct SegTree' has no member named 'upd'
   90 |             st.upd(tmp[2], tmp[3] - 1, 1e9, 1, n, 1);
      |                ^~~
seats.cpp:90:35: error: no match for 'operator-' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<int, int, int> >, std::tuple<int, int, int> >::value_type' {aka 'std::tuple<int, int, int>'} and 'int')
   90 |             st.upd(tmp[2], tmp[3] - 1, 1e9, 1, n, 1);
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from seats.h:3,
                 from seats.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)'
  500 |     operator-(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:500:5: note:   template argument deduction/substitution failed:
seats.cpp:90:37: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<int, int, int> >, std::tuple<int, int, int> >::value_type' {aka 'std::tuple<int, int, int>'} is not derived from 'const std::reverse_iterator<_Iterator>'
   90 |             st.upd(tmp[2], tmp[3] - 1, 1e9, 1, n, 1);
      |                                     ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from seats.h:3,
                 from seats.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1533:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&)'
 1533 |     operator-(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1533:5: note:   template argument deduction/substitution failed:
seats.cpp:90:37: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<int, int, int> >, std::tuple<int, int, int> >::value_type' {aka 'std::tuple<int, int, int>'} is not derived from 'const std::move_iterator<_IteratorL>'
   90 |             st.upd(tmp[2], tmp[3] - 1, 1e9, 1, n, 1);
      |                                     ^
In file included from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from seats.cpp:2:
/usr/include/c++/10/complex:361:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const std::complex<_Tp>&, const std::complex<_Tp>&)'
  361 |     operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)
      |     ^~~~~~~~
/usr/include/c++/10/complex:361:5: note:   template argument deduction/substitution failed:
seats.cpp:90:37: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<int, int, int> >, std::tuple<int, int, int> >::value_type' {aka 'std::tuple<int, int, int>'} is not derived from 'const std::complex<_Tp>'
   90 |             st.upd(tmp[2], tmp[3] - 1, 1e9, 1, n, 1);
      |                                     ^
In file included from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from seats.cpp:2:
/usr/include/c++/10/complex:370:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const std::complex<_Tp>&, const _Tp&)'
  370 |     operator-(const complex<_Tp>& __x, const _Tp& __y)
      |     ^~~~~~~~
/usr/include/c++/10/complex:370:5: note:   template argument deduction/substitution failed:
seats.cpp:90:37: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<int, int, int> >, std::tuple<int, int, int> >::value_type' {aka 'std::tuple<int, int, int>'} is not derived from 'const std::complex<_Tp>'
   90 |             st.upd(tmp[2], tmp[3] - 1, 1e9, 1, n, 1);
      |                                     ^
In file included from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from seats.cpp:2:
/usr/include/c++/10/complex:379:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const _Tp&, const std::complex<_Tp>&)'
  379 |     operator-(const _Tp& __x, const complex<_Tp>& __y)
      |     ^~~~~~~~
/usr/include/c++/10/complex:379:5: note:   template argument deduction/substitution failed:
seats.cpp:90:37: note:   mismatched types 'const std::complex<_Tp>' and 'int'
   90 |             st.upd(tmp[2], tmp[3] - 1, 1e9, 1, n, 1);
      |                                     ^
In file included from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/