#include <bits/stdc++.h>
using namespace std;
#define ss second
#define ff first
typedef long long ll;
#define int ll
int mod = 1e9+7;
int inf = 1e18;
int travel_plan(int N, int M, int R[][2], int L[], int k, int p[]){
int n = N, m = M;
vector<vector<pair<int,int>>> adj(n);
for(int i = 0; i < m; ++i){
int a = R[i][0],b = R[i][1],c = L[i];
adj[a].push_back({b,c});
adj[b].push_back({a,c});
}
set<int> exit;
for(int i = 0; i < k; ++i){
exit.insert(p[i]);
}
priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>> pq;
vector<int> dis(n, 1e10);
int ans = 1e10;
dis[0] = 0;
pq.push({0,0});
bool pass = 0;
while(!pq.empty()){
pair<int,int> a = pq.top(); pq.pop();
if(dis[a.ss]!=a.ff){
continue;
}
if(exit.find(a.ss)!=exit.end()){
ans = min(ans, a.ff);
}
pass = false;
for(auto &[nxt, w] : adj[a.ss]){
if(a.ff+w<nxt&&pass){
pq.push({a.ff+w,nxt});
}else if(a.ff+w>=nxt){
continue;
}
pass = true;
}
}
return ans;
}
Compilation message
/usr/bin/ld: /tmp/ccKCSRBp.o: in function `main':
grader.cpp:(.text.startup+0x36): undefined reference to `travel_plan(int, int, int (*) [2], int*, int, int*)'
collect2: error: ld returned 1 exit status