#include <bits/stdc++.h>
using namespace std ;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define ld long double
#define f(i,a,b) for(int i=a;i<b;++i)
#define endl '\n'
#define debug cout<<"\n========================================\n";
#define err1(a) cout<<#a<<" "<<a<<endl;
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl;
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl;
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl;
#define PQ priority_queue
#define LB lower_bound
#define UB upper_bound
#define fr first
#define sc second
#define all(a) (a).begin(),(a).end()
#define allr(a) (a).rbegin(),(a).rend()
#define show(a) {for(auto xyz:a)cout<<xyz<<" ";cout<<endl;}
#define sz(x) (int)(x).size()
const int INF = 1e18 ;
void dfs(int i,int p,vector< vector< array<int,2> > > &g,vector<int> &best){
vector<int> V ;
for(auto [j,w]:g[i]) if(j!=p){
dfs(j, i, g, best) ;
V.push_back(best[j] + w) ;
}
sort(all(V)) ;
best[i] = V[1] ;
}
int travel_plan(int N,int M,vector<array<int,2> > R,vector<int> L,int K,vector<int> P){
vector< vector< array<int,2> > > g(N) ;
f(i,0,M){
int u = R[i][0], v = R[i][1], w = L[i] ;
g[u].push_back({v, w}) ;
g[v].push_back({u, w}) ;
}
vector<int> best(N,-1) ;
for(auto i:P) best[i] = 0 ;
dfs(0,0,g,best) ;
return best[0] ;
}
Compilation message
/tmp/cc3edP1t.o: In function `main':
grader.cpp:(.text.startup+0x32): undefined reference to `travel_plan(int, int, int (*) [2], int*, int, int*)'
collect2: error: ld returned 1 exit status