#include "code.h"
#include <bits/stdc++.h>
using namespace std;
int travel_plan(int n, int m, int r[][2], int l[], int k, int p[]) {
vector<vector<pair<int, int>>> g(n);
for (int i = 0; i < m; i++) {
g[r[i][0]].push_back({r[i][1], l[i]});
g[r[i][1]].push_back({r[i][0], l[i]});
}
const int inf = INT_MAX;
vector<int> dist(n, inf);
set<pair<int, int>> que;
for (int i = 0; i < k; i++) {
for (auto& e : g[p[i]]) {
que.insert({e.second, e.first});
}
dist[p[i]] = 0;
}
vector<int> cnt(n);
vector<bool> was(n, false);
while (!que.empty()) {
auto x = *que.begin();
que.erase(que.begin());
if (was[x.second]) {
continue;
}
cnt[x.second]++;
if (cnt[x.second] == 2) {
was[x.second] = true;
dist[x.second] = x.first;
for (auto y : g[x.second]) {
que.insert({y.second + x.first, y.first});
}
}
}
return dist[0];
}
Compilation message
crocodile.cpp:1:10: fatal error: code.h: No such file or directory
1 | #include "code.h"
| ^~~~~~~~
compilation terminated.