#include <bits/stdc++.h>
#include "crocodile.h"
#include "grader.cpp"
using namespace std;
#define ff first
#define ss second
#define pii pair<int, int>
using ll = long long;
vector<bool> ext, vis;
vector<ll> v, dis;
vector<vector<pii>> E;
void dfs(int x, int p = -1) {
vis[x] = true;
if (!dis[x]) return v[x] = 0, void();
for (auto [i, w] : E[x]) {
if (!vis[i]) dfs(i, x);
}
vector<ll> u;
for (auto [i, w] : E[x]) {
if (i != p && v[i] != LLONG_MAX && dis[x] != w + dis[i]) u.push_back(v[i] + w);
}
if (!u.empty()) v[x] = *min_element(u.begin(), u.end());
}
int travel_plan(int n, int M, int R[][2], int L[], int K, int P[]) {
E.assign(n, {});
for (int i = 0; i < M; i++) {
E[R[i][0]].push_back({R[i][1], L[i]});
E[R[i][1]].push_back({R[i][0], L[i]});
}
dis.assign(n, LLONG_MAX);
priority_queue<pair<ll, int>> q;
for (int i = 0; i < K; i++) {
dis[P[i]] = 0;
q.push({0, P[i]});
}
while (!q.empty()) {
auto [d, x] = q.top(); d = -d; q.pop();
if (d != dis[x]) continue;
for (auto [i, w] : E[x]) {
if (d + w < dis[i]) {
dis[i] = d + w;
q.push({-dis[i], i});
}
}
}
vis.assign(n, false);
v.assign(n, LLONG_MAX);
dfs(0);
return v[0];
}
Compilation message
/usr/bin/ld: /tmp/ccLyWFwd.o: in function `read_input()':
grader.cpp:(.text+0x0): multiple definition of `read_input()'; /tmp/ccZupGzb.o:crocodile.cpp:(.text+0x90): first defined here
/usr/bin/ld: /tmp/ccLyWFwd.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccZupGzb.o:crocodile.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status