Submission #1158425

#TimeUsernameProblemLanguageResultExecution timeMemory
1158425timoniRoad Construction (JOI21_road_construction)C++17
Compilation error
0 ms0 KiB
// made by Tima
// 2025 will be a golden year...
//BREAK YOUR LIMITS!!!!
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define int long long
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define pii pair<int,int>
#define tpii pair <pair <int,int> , int>
using namespace std;
using namespace __gnu_pbds;
const int N = 3e5 + 5 , M = 5e5 + 5;
int mod = 1e9 + 7;
const int INF = 1e18;
int n,k,x[N],y[N],root[M],y1[N],val[3][N],timer;
pii p[N];
tpii br[N];
struct node{
	int x,i,l,r;
}t[60 * N];
void build(int &v , int tl = 1 , int tr = n){
	if(!v) v = ++ timer;
	if(tl == tr){
		t[v].x = INF;
		t[v].i = tl;
		return;
	}
	int tm = tl + tr >> 1;
	build(t[v].l , tl , tm);
	build(t[v].r , tm + 1 , tr);
	t[v].x = min(t[t[v].l].x , t[t[v].r].x);
}
void upd(int nv , int &v , int pos , int x , int tl = 1 , int tr = n){
	if(!v) v = ++ timer;
	if(tl == tr){
		// cout << tl << ' ' << x << '\n';
		t[v].x = x;
		t[v].i = tl;
		return;
	}
	int tm = tl + tr >> 1;
	if(pos <= tm){
		t[v].r = t[nv].r;
		upd(t[nv].l , t[v].l , pos , x , tl , tm);
	}
	else{
		t[v].l = t[nv].l;
		upd(t[nv].r , t[v].r , pos , x , tm + 1 , tr);
	}
	if(t[t[v].l].x <= t[t[v].r].x){
		t[v].i = t[t[v].l].i;
	}
	else{
		t[v].i = t[t[v].r].i;
	}
	t[v].x = min(t[t[v].l].x , t[t[v].r].x);
	// cout << " v -- > " << v << ' ' << tl << ' ' << tr << ' ' << t[v].x << ' ' << t[v].i << '\n';
}
pii get(int v , int l , int r , int tl = 1 , int tr = n){
	if(tl > r || tr < l) return {INF , INF};
	if(tl >= l && tr <= r) return {t[v].x , t[v].i};
	int tm = tl + tr >> 1;
	return min(get(t[v].l , l , r , tl , tm) , get(t[v].r , l , r , tm + 1 , tr));
}
void Gold(){
	cin >> n >> k;
	set <int> st1;
	map <int,int> mp,last;
	map <int,int> mp1;
	for(int i = 1 ; i <= n ; i++){
		cin >> x[i] >> y[i];
		p[i] = {y[i] , x[i]};
	}
	sort(p + 1 , p + n + 1);
	for(int i = 1 ; i <= n ; i++){
		x[i] = p[i].S , y[i] = p[i].F;
		br[i] = {{x[i] , y[i]} , i};
	}
	sort(br + 1 , br + n + 1);
	for(int i = 1 ; i <= n ; i++){
		x[i] = br[i].F.F , y[i] = br[i].F.S , y1[i] = br[i].S;
		// cout << x[i] << ' ' << y[i] << ' ' << y1[i] << '\n';
	}
	// cout << '\n';
	int cnt = 1;
	// 1 pers
	build(root[1]);
	multiset <pair <pii , pii>> st;
	val[1][1] = 1;
	for(int i = 2 ; i <= n ; i++){
		++cnt;
		upd(root[cnt - 1] , root[cnt] , y1[i - 1] , y[i - 1] - x[i - 1]);
		// cout << "DO\n";
		val[1][i] = cnt;
		pii b = get(root[cnt] , y1[i] + 1 , n);
		st.insert({{b.F + x[i] - y[i] , b.S} , {i , 1}});
	}
	// 2 pers
	build(root[++cnt]);
	val[2][1] = cnt;
	for(int i = 2 ; i <= n ; i++){
		++cnt;
		upd(root[cnt - 1] , root[cnt] , y1[i - 1] , -x[i - 1] - y[i - 1]);
		val[2][i] = cnt;
		pii b = get(root[cnt] , 1 , y1[i] - 1);
		// cout << i << ' ' << b.F << ' ' << b.S << ' ' << x[i] + y[i] << '\n';
		st.insert({{b.F + x[i] + y[i] , b.S} , {i , 2}});
	}
	while(k--){
		pair <pii , pii> th = *st.begin();
		int i = th.S.F , d = th.F.F , yj = th.F.S , tp = th.S.S;
		cout << d << '\n';
		upd(root[val[tp][i]] , root[++cnt] , yj , INF);
		val[tp][i] = cnt;
		if(tp == 1){
			pii b = get(root[cnt] , y1[i] + 1 , n);
			st.insert({{b.F + x[i] - y[i] , b.S} , {i , 1}});
		}
		else{
			pii b = get(root[cnt] , 1 , y1[i] - 1);
			st.insert({{b.F + x[i] + y[i] , b.S} , {i , 2}});
		}
		st.erase(st.find(th));
	}
}
signed main(/*Zhunussov Temirlan*/){
	//freopen("txt.in","r",stdin);freopen("txt.out","w",stdout);
	ios_base::sync_with_stdio(0);cin.tie(0);
	srand(time(0));
	int TT = 1;
	// cin >> TT;
	for(int i = 1 ; i <= TT ; i++){
		//cout << "Case " << i << ": ";
		Gold();
	}
}

Compilation message (stderr)

road_construction.cpp:22:31: error: 'long long int y1 [300005]' redeclared as different kind of entity
   22 | int n,k,x[N],y[N],root[M],y1[N],val[3][N],timer;
      |                               ^
In file included from /usr/include/features.h:486,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/c++config.h:586,
                 from /usr/include/c++/11/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:33,
                 from road_construction.cpp:4:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:224:1: note: previous declaration 'double y1(double)'
  224 | __MATHCALL (y1,, (_Mdouble_));
      | ^~~~~~~~~~
road_construction.cpp: In function 'void Gold()':
road_construction.cpp:88:59: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   88 |                 x[i] = br[i].F.F , y[i] = br[i].F.S , y1[i] = br[i].S;
      |                                                           ^
road_construction.cpp:88:61: error: assignment of read-only location '*(y1 + ((sizetype)i))'
   88 |                 x[i] = br[i].F.F , y[i] = br[i].F.S , y1[i] = br[i].S;
      |                                                             ^
road_construction.cpp:99:57: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   99 |                 upd(root[cnt - 1] , root[cnt] , y1[i - 1] , y[i - 1] - x[i - 1]);
      |                                                         ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
road_construction.cpp:99:57: error: invalid conversion from 'double (*)(double) noexcept' to 'long long int' [-fpermissive]
   99 |                 upd(root[cnt - 1] , root[cnt] , y1[i - 1] , y[i - 1] - x[i - 1]);
      |                                                 ~~~~~~~~^
      |                                                         |
      |                                                         double (*)(double) noexcept
road_construction.cpp:40:32: note:   initializing argument 3 of 'void upd(long long int, long long int&, long long int, long long int, long long int, long long int)'
   40 | void upd(int nv , int &v , int pos , int x , int tl = 1 , int tr = n){
      |                                ^
road_construction.cpp:102:45: warning: pointer to a function used in arithmetic [-Wpointer-arith]
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                                             ^
road_construction.cpp:102:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                                         ~~~~~~^~~
road_construction.cpp:102:28: error: no matching function for call to 'get(long long int&, double (*)(double) noexcept, long long int&)'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/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(pair<_Tp1, _Tp2>& __in) noexcept
      |     ^~~
/usr/include/c++/11/utility:223:5: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'std::pair<_Tp1, _Tp2>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/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(pair<_Tp1, _Tp2>&& __in) noexcept
      |     ^~~
/usr/include/c++/11/utility:228:5: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'std::pair<_Tp1, _Tp2>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/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 pair<_Tp1, _Tp2>& __in) noexcept
      |     ^~~
/usr/include/c++/11/utility:233:5: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'const std::pair<_Tp1, _Tp2>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/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 pair<_Tp1, _Tp2>&& __in) noexcept
      |     ^~~
/usr/include/c++/11/utility:238:5: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'const std::pair<_Tp1, _Tp2>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/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++/11/utility:247:5: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'std::pair<_T1, _T2>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/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++/11/utility:252:5: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'const std::pair<_T1, _T2>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/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++/11/utility:257:5: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'std::pair<_T1, _T2>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/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++/11/utility:262:5: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'const std::pair<_T1, _T2>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/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++/11/utility:267:5: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'std::pair<_Up, _Tp>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/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++/11/utility:272:5: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'const std::pair<_Up, _Tp>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/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++/11/utility:277:5: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'std::pair<_Up, _Tp>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/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++/11/utility:282:5: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'const std::pair<_Up, _Tp>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/tuple:39,
                 from /usr/include/c++/11/functional:54,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/array:361:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp& std::get(std::array<_Tp, _Nm>&)'
  361 |     get(array<_Tp, _Nm>& __arr) noexcept
      |     ^~~
/usr/include/c++/11/array:361:5: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'std::array<_Tp, _Nm>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/tuple:39,
                 from /usr/include/c++/11/functional:54,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/array:369:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp&& std::get(std::array<_Tp, _Nm>&&)'
  369 |     get(array<_Tp, _Nm>&& __arr) noexcept
      |     ^~~
/usr/include/c++/11/array:369:5: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'std::array<_Tp, _Nm>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/tuple:39,
                 from /usr/include/c++/11/functional:54,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/array:377:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp& std::get(const std::array<_Tp, _Nm>&)'
  377 |     get(const array<_Tp, _Nm>& __arr) noexcept
      |     ^~~
/usr/include/c++/11/array:377:5: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'const std::array<_Tp, _Nm>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/tuple:39,
                 from /usr/include/c++/11/functional:54,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/array:385:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp&& std::get(const std::array<_Tp, _Nm>&&)'
  385 |     get(const array<_Tp, _Nm>&& __arr) noexcept
      |     ^~~
/usr/include/c++/11/array:385:5: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'const std::array<_Tp, _Nm>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/functional:54,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/tuple:1393:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_UTypes ...> >& std::get(std::tuple<_UTypes ...>&)'
 1393 |     get(tuple<_Elements...>& __t) noexcept
      |     ^~~
/usr/include/c++/11/tuple:1393:5: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'std::tuple<_UTypes ...>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/functional:54,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/tuple:1399: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 ...>&)'
 1399 |     get(const tuple<_Elements...>& __t) noexcept
      |     ^~~
/usr/include/c++/11/tuple:1399:5: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'const std::tuple<_UTypes ...>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/functional:54,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/tuple:1405:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_UTypes ...> >&& std::get(std::tuple<_UTypes ...>&&)'
 1405 |     get(tuple<_Elements...>&& __t) noexcept
      |     ^~~
/usr/include/c++/11/tuple:1405:5: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'std::tuple<_UTypes ...>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/functional:54,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/tuple:1414: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 ...>&&)'
 1414 |     get(const tuple<_Elements...>&& __t) noexcept
      |     ^~~
/usr/include/c++/11/tuple:1414:5: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'const std::tuple<_UTypes ...>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/functional:54,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/tuple:1449:5: note: candidate: 'template<class _Tp, class ... _Types> constexpr _Tp& std::get(std::tuple<_UTypes ...>&)'
 1449 |     get(tuple<_Types...>& __t) noexcept
      |     ^~~
/usr/include/c++/11/tuple:1449:5: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'std::tuple<_UTypes ...>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/functional:54,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/tuple:1460:5: note: candidate: 'template<class _Tp, class ... _Types> constexpr _Tp&& std::get(std::tuple<_UTypes ...>&&)'
 1460 |     get(tuple<_Types...>&& __t) noexcept
      |     ^~~
/usr/include/c++/11/tuple:1460:5: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'std::tuple<_UTypes ...>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/functional:54,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/tuple:1471:5: note: candidate: 'template<class _Tp, class ... _Types> constexpr const _Tp& std::get(const std::tuple<_UTypes ...>&)'
 1471 |     get(const tuple<_Types...>& __t) noexcept
      |     ^~~
/usr/include/c++/11/tuple:1471:5: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'const std::tuple<_UTypes ...>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/functional:54,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/tuple:1483:5: note: candidate: 'template<class _Tp, class ... _Types> constexpr const _Tp&& std::get(const std::tuple<_UTypes ...>&&)'
 1483 |     get(const tuple<_Types...>&& __t) noexcept
      |     ^~~
/usr/include/c++/11/tuple:1483:5: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'const std::tuple<_UTypes ...>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:133,
                 from road_construction.cpp:4:
/usr/include/c++/11/variant:1676:5: note: candidate: 'template<long unsigned int _Np, class ... _Types> constexpr std::variant_alternative_t<_Np, std::variant<_Types ...> >& std::get(std::variant<_Types ...>&)'
 1676 |     get(variant<_Types...>& __v)
      |     ^~~
/usr/include/c++/11/variant:1676:5: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'std::variant<_Types ...>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:133,
                 from road_construction.cpp:4:
/usr/include/c++/11/variant:1687:5: note: candidate: 'template<long unsigned int _Np, class ... _Types> constexpr std::variant_alternative_t<_Np, std::variant<_Types ...> >&& std::get(std::variant<_Types ...>&&)'
 1687 |     get(variant<_Types...>&& __v)
      |     ^~~
/usr/include/c++/11/variant:1687:5: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'std::variant<_Types ...>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:133,
                 from road_construction.cpp:4:
/usr/include/c++/11/variant:1698: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 ...>&)'
 1698 |     get(const variant<_Types...>& __v)
      |     ^~~
/usr/include/c++/11/variant:1698:5: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'const std::variant<_Types ...>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:133,
                 from road_construction.cpp:4:
/usr/include/c++/11/variant:1709: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 ...>&&)'
 1709 |     get(const variant<_Types...>&& __v)
      |     ^~~
/usr/include/c++/11/variant:1709:5: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'const std::variant<_Types ...>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:133,
                 from road_construction.cpp:4:
/usr/include/c++/11/variant:1117:20: note: candidate: 'template<class _Tp, class ... _Types> constexpr _Tp& std::get(std::variant<_Types ...>&)'
 1117 |     constexpr _Tp& get(variant<_Types...>& __v)
      |                    ^~~
/usr/include/c++/11/variant:1117:20: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'std::variant<_Types ...>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:133,
                 from road_construction.cpp:4:
/usr/include/c++/11/variant:1126:21: note: candidate: 'template<class _Tp, class ... _Types> constexpr _Tp&& std::get(std::variant<_Types ...>&&)'
 1126 |     constexpr _Tp&& get(variant<_Types...>&& __v)
      |                     ^~~
/usr/include/c++/11/variant:1126:21: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'std::variant<_Types ...>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:133,
                 from road_construction.cpp:4:
/usr/include/c++/11/variant:1136:26: note: candidate: 'template<class _Tp, class ... _Types> constexpr const _Tp& std::get(const std::variant<_Types ...>&)'
 1136 |     constexpr const _Tp& get(const variant<_Types...>& __v)
      |                          ^~~
/usr/include/c++/11/variant:1136:26: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'const std::variant<_Types ...>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:133,
                 from road_construction.cpp:4:
/usr/include/c++/11/variant:1145:27: note: candidate: 'template<class _Tp, class ... _Types> constexpr const _Tp&& std::get(const std::variant<_Types ...>&&)'
 1145 |     constexpr const _Tp&& get(const variant<_Types...>&& __v)
      |                           ^~~
/usr/include/c++/11/variant:1145:27: note:   template argument deduction/substitution failed:
road_construction.cpp:102:28: note:   mismatched types 'const std::variant<_Types ...>' and 'long long int'
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
road_construction.cpp:66:5: note: candidate: 'std::pair<long long int, long long int> get(long long int, long long int, long long int, long long int, long long int)' (near match)
   66 | pii get(int v , int l , int r , int tl = 1 , int tr = n){
      |     ^~~
road_construction.cpp:66:5: note:   conversion of argument 2 would be ill-formed:
road_construction.cpp:102:47: error: invalid conversion from 'double (*)(double) noexcept' to 'long long int' [-fpermissive]
  102 |                 pii b = get(root[cnt] , y1[i] + 1 , n);
      |                                         ~~~~~~^~~
      |                                               |
      |                                               double (*)(double) noexcept
road_construction.cpp:110:57: warning: pointer to a function used in arithmetic [-Wpointer-arith]
  110 |                 upd(root[cnt - 1] , root[cnt] , y1[i - 1] , -x[i - 1] - y[i - 1]);
      |                                                         ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
road_construction.cpp:110:57: error: invalid conversion from 'double (*)(double) noexcept' to 'long long int' [-fpermissive]
  110 |                 upd(root[cnt - 1] , root[cnt] , y1[i - 1] , -x[i - 1] - y[i - 1]);
      |                                                 ~~~~~~~~^
      |                                                         |
      |                                                         double (*)(double) noexcept
road_construction.cpp:40:32: note:   initializing argument 3 of 'void upd(long long int, long long int&, long long int, long long int, long long int, long long int)'
   40 | void upd(int nv , int &v , int pos , int x , int tl = 1 , int tr = n){
      |                                ^
road_construction.cpp:112:49: warning: pointer to a function used in arithmetic [-Wpointer-arith]
  112 |                 pii b = get(root[cnt] , 1 , y1[i] - 1);
      |                                                 ^
road_construction.cpp:112:51: warning: pointer to a function used in arithmetic [-Wpointer-arith]
  112 |                 pii b = get(root[cnt] , 1 , y1[i] - 1);
      |                                             ~~~~~~^~~
road_construction.cpp:112:28: error: no matching function for call to 'get(long long int&, int, double (*)(double) noexcept)'
  112 |                 pii b = get(root[cnt] , 1 , y1[i] - 1);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/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(pair<_Tp1, _Tp2>& __in) noexcept
      |     ^~~
/usr/include/c++/11/utility:223:5: note:   template argument deduction/substitution failed:
road_construction.cpp:112:28: note:   mismatched types 'std::pair<_Tp1, _Tp2>' and 'long long int'
  112 |                 pii b = get(root[cnt] , 1 , y1[i] - 1);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/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(pair<_Tp1, _Tp2>&& __in) noexcept
      |     ^~~
/usr/include/c++/11/utility:228:5: note:   template argument deduction/substitution failed:
road_construction.cpp:112:28: note:   mismatched types 'std::pair<_Tp1, _Tp2>' and 'long long int'
  112 |                 pii b = get(root[cnt] , 1 , y1[i] - 1);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/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 pair<_Tp1, _Tp2>& __in) noexcept
      |     ^~~
/usr/include/c++/11/utility:233:5: note:   template argument deduction/substitution failed:
road_construction.cpp:112:28: note:   mismatched types 'const std::pair<_Tp1, _Tp2>' and 'long long int'
  112 |                 pii b = get(root[cnt] , 1 , y1[i] - 1);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/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 pair<_Tp1, _Tp2>&& __in) noexcept
      |     ^~~
/usr/include/c++/11/utility:238:5: note:   template argument deduction/substitution failed:
road_construction.cpp:112:28: note:   mismatched types 'const std::pair<_Tp1, _Tp2>' and 'long long int'
  112 |                 pii b = get(root[cnt] , 1 , y1[i] - 1);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/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++/11/utility:247:5: note:   template argument deduction/substitution failed:
road_construction.cpp:112:28: note:   mismatched types 'std::pair<_T1, _T2>' and 'long long int'
  112 |                 pii b = get(root[cnt] , 1 , y1[i] - 1);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/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++/11/utility:252:5: note:   template argument deduction/substitution failed:
road_construction.cpp:112:28: note:   mismatched types 'const std::pair<_T1, _T2>' and 'long long int'
  112 |                 pii b = get(root[cnt] , 1 , y1[i] - 1);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/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++/11/utility:257:5: note:   template argument deduction/substitution failed:
road_construction.cpp:112:28: note:   mismatched types 'std::pair<_T1, _T2>' and 'long long int'
  112 |                 pii b = get(root[cnt] , 1 , y1[i] - 1);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/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++/11/utility:262:5: note:   template argument deduction/substitution failed:
road_construction.cpp:112:28: note:   mismatched types 'const std::pair<_T1, _T2>' and 'long long int'
  112 |                 pii b = get(root[cnt] , 1 , y1[i] - 1);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/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++/11/utility:267:5: note:   template argument deduction/substitution failed:
road_construction.cpp:112:28: note:   mismatched types 'std::pair<_Up, _Tp>' and 'long long int'
  112 |                 pii b = get(root[cnt] , 1 , y1[i] - 1);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/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++/11/utility:272:5: note:   template argument deduction/substitution failed:
road_construction.cpp:112:28: note:   mismatched types 'const std::pair<_Up, _Tp>' and 'long long int'
  112 |                 pii b = get(root[cnt] , 1 , y1[i] - 1);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/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++/11/utility:277:5: note:   template argument deduction/substitution failed:
road_construction.cpp:112:28: note:   mismatched types 'std::pair<_Up, _Tp>' and 'long long int'
  112 |                 pii b = get(root[cnt] , 1 , y1[i] - 1);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/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++/11/utility:282:5: note:   template argument deduction/substitution failed:
road_construction.cpp:112:28: note:   mismatched types 'const std::pair<_Up, _Tp>' and 'long long int'
  112 |                 pii b = get(root[cnt] , 1 , y1[i] - 1);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/tuple:39,
                 from /usr/include/c++/11/functional:54,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/array:361:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp& std::get(std::array<_Tp, _Nm>&)'
  361 |     get(array<_Tp, _Nm>& __arr) noexcept
      |     ^~~
/usr/include/c++/11/array:361:5: note:   template argument deduction/substitution failed:
road_construction.cpp:112:28: note:   mismatched types 'std::array<_Tp, _Nm>' and 'long long int'
  112 |                 pii b = get(root[cnt] , 1 , y1[i] - 1);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/tuple:39,
                 from /usr/include/c++/11/functional:54,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/array:369:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp&& std::get(std::array<_Tp, _Nm>&&)'
  369 |     get(array<_Tp, _Nm>&& __arr) noexcept
      |     ^~~
/usr/include/c++/11/array:369:5: note:   template argument deduction/substitution failed:
road_construction.cpp:112:28: note:   mismatched types 'std::array<_Tp, _Nm>' and 'long long int'
  112 |                 pii b = get(root[cnt] , 1 , y1[i] - 1);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/tuple:39,
                 from /usr/include/c++/11/functional:54,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/array:377:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp& std::get(const std::array<_Tp, _Nm>&)'
  377 |     get(const array<_Tp, _Nm>& __arr) noexcept
      |     ^~~
/usr/include/c++/11/array:377:5: note:   template argument deduction/substitution failed:
road_construction.cpp:112:28: note:   mismatched types 'const std::array<_Tp, _Nm>' and 'long long int'
  112 |                 pii b = get(root[cnt] , 1 , y1[i] - 1);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/tuple:39,
                 from /usr/include/c++/11/functional:54,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/array:385:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp&& std::get(const std::array<_Tp, _Nm>&&)'
  385 |     get(const array<_Tp, _Nm>&& __arr) noexcept
      |     ^~~
/usr/include/c++/11/array:385:5: note:   template argument deduction/substitution failed:
road_construction.cpp:112:28: note:   mismatched types 'const std::array<_Tp, _Nm>' and 'long long int'
  112 |                 pii b = get(root[cnt] , 1 , y1[i] - 1);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/functional:54,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/tuple:1393:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_UTypes ...> >& std::get(std::tuple<_UTypes ...>&)'
 1393 |     get(tuple<_Elements...>& __t) noexcept
      |     ^~~
/usr/include/c++/11/tuple:1393:5: note:   template argument deduction/substitution failed:
road_construction.cpp:112:28: note:   mismatched types 'std::tuple<_UTypes ...>' and 'long long int'
  112 |                 pii b = get(root[cnt] , 1 , y1[i] - 1);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/functional:54,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/tuple:1399: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 ...>&)'
 1399 |     get(const tuple<_Elements...>& __t) noexcept
      |     ^~~
/usr/include/c++/11/tuple:1399:5: note:   template argument deduction/substitution failed:
road_construction.cpp:112:28: note:   mismatched types 'const std::tuple<_UTypes ...>' and 'long long int'
  112 |                 pii b = get(root[cnt] , 1 , y1[i] - 1);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/functional:54,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/tuple:1405:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_UTypes ...> >&& std::get(std::tuple<_UTypes ...>&&)'
 1405 |     get(tuple<_Elements...>&& __t) noexcept
      |     ^~~
/usr/include/c++/11/tuple:1405:5: note:   template argument deduction/substitution failed:
road_construction.cpp:112:28: note:   mismatched types 'std::tuple<_UTypes ...>' and 'long long int'
  112 |                 pii b = get(root[cnt] , 1 , y1[i] - 1);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/functional:54,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/tuple:1414: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 ...>&&)'
 1414 |     get(const tuple<_Elements...>&& __t) noexcept
      |     ^~~
/usr/include/c++/11/tuple:1414:5: note:   template argument deduction/substitution failed:
road_construction.cpp:112:28: note:   mismatched types 'const std::tuple<_UTypes ...>' and 'long long int'
  112 |                 pii b = get(root[cnt] , 1 , y1[i] - 1);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/functional:54,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/tuple:1449:5: note: candidate: 'template<class _Tp, class ... _Types> constexpr _Tp& std::get(std::tuple<_UTypes ...>&)'
 1449 |     get(tuple<_Types...>& __t) noexcept
      |     ^~~
/usr/include/c++/11/tuple:1449:5: note:   template argument deduction/substitution failed:
road_construction.cpp:112:28: note:   mismatched types 'std::tuple<_UTypes ...>' and 'long long int'
  112 |                 pii b = get(root[cnt] , 1 , y1[i] - 1);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/functional:54,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/tuple:1460:5: note: candidate: 'template<class _Tp, class ... _Types> constexpr _Tp&& std::get(std::tuple<_UTypes ...>&&)'
 1460 |     get(tuple<_Types...>&& __t) noexcept
      |     ^~~
/usr/include/c++/11/tuple:1460:5: note:   template argument deduction/substitution failed:
road_construction.cpp:112:28: note:   mismatched types 'std::tuple<_UTypes ...>' and 'long long int'
  112 |                 pii b = get(root[cnt] , 1 , y1[i] - 1);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/functional:54,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/tuple:1471:5: note: candidate: 'template<class _Tp, class ... _Types> constexpr const _Tp& std::get(const std::tuple<_UTypes ...>&)'
 1471 |     get(const tuple<_Types...>& __t) noexcept
      |     ^~~
/usr/include/c++/11/tuple:1471:5: note:   template argument deduction/substitution failed:
road_construction.cpp:112:28: note:   mismatched types 'const std::tuple<_UTypes ...>' and 'long long int'
  112 |                 pii b = get(root[cnt] , 1 , y1[i] - 1);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/functional:54,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from road_construction.cpp:4:
/usr/include/c++/11/tuple:1483:5: note: candidate: 'template<class _Tp, class ... _Types> constexpr const _Tp&& std::get(const std::tuple<_UTypes ...>&&)'
 1483 |     get(const tuple<_Types...>&& __t) noexcept
      |     ^~~
/usr/include/c++/11/tuple:1483:5: note: