#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define int long long
#define itr ::iterator
typedef pair<int,int> pii;
const int MAX=1e6;
const int INF=1e9+9;
vector<pii> vec[MAX];
int mark[MAX],dp[MAX],deg[MAX];
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
for(int A=0;A<M;A++)
{
vec[R[A][0]].pb(mp(R[A][1],L[A]));
vec[R[A][1]].pb(mp(R[A][0],L[A]));
}
priority_queue<pii,vector<pii>,greater<pii>> pq;
for(int A=0;A<K;A++)
{
deg[P[A]]=1;
pq.push(mp(0,P[A]));
}
while(!pq.empty())
{
pii cur=pq.top();
pq.pop();
deg[cur.second]++;
if(deg[cur.second]!=2)
continue;
dp[cur.second]=cur.first;
for(auto A:vec[cur.second])
if(deg[A.first]<2)
pq.push(mp(cur.first+A.second,A.first));
}
return dp[0];
}
/*signed main()
{
int N,M,K,R[MAX][2],L[MAX],P[MAX];
cin>>N>>M>>K;
for(int A=0;A<M;A++)
cin>>R[A][0]>>R[A][1]>>L[A];
for(int A=0;A<K;A++)
cin>>P[A];
cout<<travel_plan(N,M,R,L,K,P);
return 0;
}*/
Compilation message
/tmp/cckbPkGF.o: In function `main':
grader.cpp:(.text.startup+0x2d): undefined reference to `travel_plan(int, int, int (*) [2], int*, int, int*)'
collect2: error: ld returned 1 exit status