Submission #855166

#TimeUsernameProblemLanguageResultExecution timeMemory
855166mbfibatDynamic Diameter (CEOI19_diameter)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<int, int> ii; const int N = 1e5 + 11; vector<ii> adj[N]; bool is_c[N]; int totChild = 0; int nChild[N]; int parCentroid[N]; void cal_child(int u, int p = 0) { nChild[u] = 1; for (auto [v, w] : adj[u]) if (!is_c[v] && v != p) { cal_child(v, u); nChild[u] += nChild[v]; } } int find_c(int u, int p = 0) { for (auto [v, w] : adj[u]) if (v != p && !is_c[v] && nChild[v] > totChild / 2) return find_c(v, u); return u; } unordered_map<int, LL> dist; struct Node { LL val = 0, lazy = 0; Node* l = nullptr, *r = nullptr; Node(){} }; Node* Seg[N]; void build(Node *cur, int l, int r) { if (l == r) { cur -> val = dist[l]; return; } cur -> l = new Node(); cur -> r = new Node(); int mi = (l + r) / 2; build(cur -> l, l, mi); build(cur -> r, mi + 1, r); cur -> val = max(cur -> l -> val, cur -> r -> val); } void diffuse(Node *cur, int l, int r) { if (cur -> lazy) { cur -> val += cur -> lazy; if (l != r) { cur -> l -> lazy += cur -> lazy; cur -> r -> lazy += cur -> lazy; } cur -> lazy = 0; } } void upd(Node *cur, int l, int r, int L, int R, LL val) { diffuse(cur, l, r); if (r < L || R < l) return; if (L <= l && r <= R) { cur -> lazy += val; diffuse(cur, l, r); return; } int mi = (l + r) / 2; upd(cur -> l, l, mi, L, R, val); upd(cur -> r, mi + 1, r, L, R, val); cur -> val = max(cur -> l -> val, cur -> r -> val); } LL query(Node *cur, int l, int r, int L, int R) { diffuse(cur, l, r); if (r < L || R < l) return 0LL; if (L <= l && r <= R) return cur -> val; int mi = (l + r) / 2; LL val_l = query(cur -> l, l, mi, L, R); LL val_r = query(cur -> r, mi + 1, r, L, R); return max(val_l, val_r); } int cur_root; unordered_map<int, int> top; map<ii, int> st, ed; multiset<LL> val_ms[N]; vector<pair<int, LL>> val_ord[N]; void dfs(int u, LL d = 0, int p = 0) { st[ii(cur_root, u)] = ++top[cur_root]; dist[top[cur_root]] = d; for (auto [v, w] : adj[u]) { if (is_c[v] || v == p) continue; dfs(v, d + w, u); } ed[ii(cur_root, u)] = top[cur_root]; } LL sol[N]; multiset<LL> ans; void prep(int root) { cur_root = root; Seg[root] = new Node(); dist[root] = 0; dfs(root); build(Seg[root], 1, top[root]); for (auto [v, w] : adj[root]) { if (is_c[v]) continue; int l = st[ii(root, v)], r = ed[ii(root, v)]; LL val = query(Seg[root], 1, top[root], l, r); val_ms[root].insert(val); val_ord[root].emplace_back(l, val); } sort(val_ord[root].begin(), val_ord[root].end()); val_ms[root].insert(0); val_ms[root].insert(0); val_ord[root].emplace_back(top[root] + 1, 0); auto it = val_ms[root].rbegin(); LL v1 = *it; ++it; LL v2 = *it; sol[root] = v1 + v2; ans.insert(sol[root]); } void centroid_decompose(int u, int p = 0) { cal_child(u); totChild = nChild[u]; int c = find_c(u); parCentroid[c] = p; prep(c); is_c[c] = true; for (auto [v, w] : adj[c]) if (!is_c[v]) centroid_decompose(v, c); } void upd_edge(int root, int u1, int u2, LL inc) { int u = ((st[ii(root, u1)] > st[ii(root, u2)]) ? u1 : u2); upd(Seg[root], 1, top[root], st[ii(root, u)], ed[ii(root, u)], inc); int p = upper_bound(val_ord[root].begin(), val_ord[root].end(), make_pair(st[ii(root, u)], 2000000000000000000)) - val_ord[root].begin() - 1; int l = val_ord[root][p].first, r = val_ord[root][p + 1].first - 1; LL old_val = val_ord[root][p].second; LL new_val = query(Seg[root], 1, top[root], l, r); val_ms[root].erase(val_ms[root].find(old_val)); val_ms[root].insert(new_val); val_ord[root][p].second = new_val; auto it = val_ms[root].rbegin(); LL v1 = *it; ++it; LL v2 = *it; ans.erase(ans.find(sol[root])); sol[root] = v1 + v2; ans.insert(sol[root]); if (parCentroid[root]) upd_edge(parCentroid[root], u1, u2, inc); } int32_t main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, q; LL w; cin >> n >> q >> w; vector<LL> W(n); vector<ii> edges; for (int i = 0; i < n - 1; i++) { int u, v; LL c; cin >> u >> v >> c; W[i] = c; edges.emplace_back(u, v); adj[u].emplace_back(v, c); adj[v].emplace_back(u, c); } centroid_decompose(1); int last = 0; while (q--) { int d; LL e; cin >> d >> e; d = (d + last) % (n - 1); e = (e + last) % w; LL dif = e - W[d]; W[d] = e; auto [u, v] = edges[d]; if (top[u] < top[v]) swap(u, v); upd_edge(u, u, v, dif); last = *ans.rbegin(); cout << last << '\n'; } }

Compilation message (stderr)

In file included from /usr/include/c++/10/bits/stl_algobase.h:71,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Val_less_iter::operator()(_Value&, _Iterator) const [with _Value = const std::pair<int, long int>; _Iterator = __gnu_cxx::__normal_iterator<std::pair<int, long long int>*, std::vector<std::pair<int, long long int> > >]':
/usr/include/c++/10/bits/stl_algo.h:2061:14:   required from '_ForwardIterator std::__upper_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<std::pair<int, long long int>*, std::vector<std::pair<int, long long int> > >; _Tp = std::pair<int, long int>; _Compare = __gnu_cxx::__ops::_Val_less_iter]'
/usr/include/c++/10/bits/stl_algo.h:2096:32:   required from '_FIter std::upper_bound(_FIter, _FIter, const _Tp&) [with _FIter = __gnu_cxx::__normal_iterator<std::pair<int, long long int>*, std::vector<std::pair<int, long long int> > >; _Tp = std::pair<int, long int>]'
diameter.cpp:158:113:   required from here
/usr/include/c++/10/bits/predefined_ops.h:96:22: error: no match for 'operator<' (operand types are 'const std::pair<int, long int>' and 'std::pair<int, long long int>')
   96 |       { return __val < *__it; }
      |                ~~~~~~^~~~~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1096:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __gnu_cxx::__normal_iterator<_IteratorL, _Container>&, const __gnu_cxx::__normal_iterator<_IteratorR, _Container>&)'
 1096 |     operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1096:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/10/bits/stl_algobase.h:71,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/predefined_ops.h:96:22: note:   'const std::pair<int, long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
   96 |       { return __val < *__it; }
      |                ~~~~~~^~~~~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1104:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __gnu_cxx::__normal_iterator<_Iterator, _Container>&, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&)'
 1104 |     operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1104:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/10/bits/stl_algobase.h:71,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/predefined_ops.h:96:22: note:   'const std::pair<int, long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
   96 |       { return __val < *__it; }
      |                ~~~~~~^~~~~~~
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/regex.h:1075:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const std::__cxx11::sub_match<_BiIter>&, const std::__cxx11::sub_match<_BiIter>&)'
 1075 |     operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/10/bits/regex.h:1075:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/10/bits/stl_algobase.h:71,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/predefined_ops.h:96:22: note:   'const std::pair<int, long int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   96 |       { return __val < *__it; }
      |                ~~~~~~^~~~~~~
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/regex.h:1156:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const std::__cxx11::sub_match<_BiIter>&)'
 1156 |     operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/regex.h:1156:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/10/bits/stl_algobase.h:71,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/predefined_ops.h:96:22: note:   'const std::pair<int, long int>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
   96 |       { return __val < *__it; }
      |                ~~~~~~^~~~~~~
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/regex.h:1249:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const std::__cxx11::sub_match<_BiIter>&, std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
 1249 |     operator<(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/regex.h:1249:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/10/bits/stl_algobase.h:71,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/predefined_ops.h:96:22: note:   'const std::pair<int, long int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   96 |       { return __val < *__it; }
      |                ~~~~~~^~~~~~~
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/regex.h:1323:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const std::__cxx11::sub_match<_BiIter>&)'
 1323 |     operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/regex.h:1323:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/10/bits/stl_algobase.h:71,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/predefined_ops.h:96:22: note:   'std::pair<int, long long int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   96 |       { return __val < *__it; }
      |                ~~~~~~^~~~~~~
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/regex.h:1417:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const std::__cxx11::sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
 1417 |     operator<(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/regex.h:1417:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/10/bits/stl_algobase.h:71,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/predefined_ops.h:96:22: note:   'const std::pair<int, long int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   96 |       { return __val < *__it; }
      |                ~~~~~~^~~~~~~
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/regex.h:1492:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const std::__cxx11::sub_match<_BiIter>&)'
 1492 |     operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/regex.h:1492:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/10/bits/stl_algobase.h:71,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/predefined_ops.h:96:22: note:   'std::pair<int, long long int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   96 |       { return __val < *__it; }
      |                ~~~~~~^~~~~~~
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/regex.h:1592:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const std::__cxx11::sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
 1592 |     operator<(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/regex.h:1592:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/10/bits/stl_algobase.h:71,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/predefined_ops.h:96:22: note:   'const std::pair<int, long int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   96 |       { return __val < *__it; }
      |                ~~~~~~^~~~~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:489:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)'
  489 |     operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_pair.h:489:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/10/bits/stl_algobase.h:71,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/predefined_ops.h:96:22: note:   deduced conflicting types for parameter '_T2' ('long int' and 'long long int')
   96 |       { return __val < *__it; }
      |                ~~~~~~^~~~~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:366:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)'
  366 |     operator<(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:366:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/10/bits/stl_algobase.h:71,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/predefined_ops.h:96:22: note:   'const std::pair<int, long int>' is not derived from 'const std::reverse_iterator<_Iterator>'
   96 |       { return __val < *__it; }
      |                ~~~~~~^~~~~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:404:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)'
  404 |     operator<(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:404:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/10/bits/stl_algobase.h:71,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/predefined_ops.h:96:22: note:   'const std::pair<int, long int>' is not derived from 'const std::reverse_iterator<_Iterator>'
   96 |       { return __val < *__it; }
      |                ~~~~~~^~~~~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1451:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&)'
 1451 |     operator<(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1451:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/10/bits/stl_algobase.h:71,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/predefined_ops.h:96:22: note:   'const std::pair<int, long int>' is not derived from 'const std::move_iterator<_IteratorL>'
   96 |       { return __val < *__it; }
      |                ~~~~~~^~~~~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1507:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorL>&)'
 1507 |     operator<(const move_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1507:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/10/bits/stl_algobase.h:71,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from diameter.cpp:1:
/usr/include/c++/10/bits/predefined_ops.h:96:22: note:   'const std::pair<int, long int>' is not derived from 'const std::move_iterator<_IteratorL>'
   96 |       { return __val < *__it; }
      |                ~~~~~~^~~~~~~
In file included from /usr/include/c++/10/bits/basic_string.h:48,
                 from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 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 diameter.cpp:1:
/usr/include/c++/10/string_view:544:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(std::basic_string_view<_CharT, _Traits>, std::basic_string_view<_CharT, _Traits>)'
  544 |     operator< (basic_string_view<_CharT, _Traits> __x,
      |     ^~~~~~~~
/usr/include/c++/10/string_view:544:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/10/bits/stl_algobase.h:71,
                 from /usr/include/c++/10/bits/specfun.h:45,