#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define pii pair<int, int>
int travel_plan(int n, int m, int R[][2], int L[], int k, int p[]) {
vector<vector<pii>> g(n);
for (int i=0;i<m;i++) {
int a = R[i][0], b = R[i][1];
int c = L[i];
g[a].push_back({b, c});
g[b].push_back({a, c});
}
vector<pii> dist(n, make_pair((int)1e16, (int)1e16));
for (int i=0;i<k;i++) {
dist[p[i]] = {0, 0};
}
priority_queue<pii> pq;
for (int i=0;i<n;i++) {
pq.push({-dist[i].second, i});
}
vector<bool> proc(n, false);
while (!pq.empty()) {
pii t=pq.top();pq.pop();
int node=t.second;
if (proc[node]) continue;
proc[node] = true;
for (auto x:g[node]) {
if (dist[node].second + x.second < dist[x.first].first) {
dist[x.first].second = dist[x.first].first;
dist[x.first].first = dist[node].second + x.second;
pq.push({-dist[x.first].second, x.first});
}
else if (dist[node].second + x.second < dist[x.first].second) {
dist[x.first].second = dist[node].second + x.second;
pq.push({-dist[x.first].second, x.first});
}
}
}
return dist[0].second;
}
Compilation message
/usr/bin/ld: /tmp/cc9UiAni.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