#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, m, k;
cin >> n >> m >> k;
vector<int> min1(n, 1e9 + 1), min2(n, 1e9 + 1);
vector<vector<pair<int, int>>> adj(n, vector<pair<int, int>>(0));
while (m--)
{
int a, b, c;
cin >> a >> b >> c;
adj[a].push_back({ c, b }), adj[b].push_back({ c, a });
}
priority_queue<pair<int, int>> djk;
vector<bool> prc(n, false);
while (k--)
{
int stt;
cin >> stt;
min1[stt] = 0, min2[stt] = 0;
djk.push({ 0, stt });
}
while (!djk.empty())
{
int d = -djk.top().first, node = djk.top().second;
djk.pop();
if ((d == min2[node]) && !prc[node])
{
prc[node] = true;
for (pair<int, int> nxt : adj[node])
{
if (d + nxt.first < min1[nxt.second])
{
min2[nxt.second] = min1[nxt.second];
min1[nxt.second] = d + nxt.first;
djk.push({ -d - nxt.first, nxt.second });
}
else if (d + nxt.first < min2[nxt.second])
{
min2[nxt.second] = d + nxt.first;
djk.push({ -d - nxt.first, nxt.second });
}
}
}
}
cout << min2[0];
}
Compilation message
/usr/bin/ld: /tmp/ccjBtVAr.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccotWjNr.o:crocodile.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccjBtVAr.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