#ifndef SKY
#include "crocodilelib.h"
#endif // ONLINE_JUDGE
#include<bits/stdc++.h>
#define task "eksplozija"
#define ll long long
#define fi first
#define se second
#define pii pair<int, int>
const int base = 6438;
const ll MOD = 1000000003;
const ll N = 1e6 + 2;
using namespace std;
vector<pii> vt[N];
int cnt[N];
int solve(int n, const vector<int> &u, const vector<int> &v, const vector<int> &l, const vector<int> &p)
{
for(int i = 0; i < v.size(); i++)
vt[v[i]].push_back({u[i], l[i]}), vt[u[i]].push_back({v[i], l[i]});
priority_queue<pii, vector<pii>, greater<pii>> q;
for(auto i : p)
q.push({0, i}), cnt[i] = 1;
while(!q.empty())
{
pii tmp = q.top();
int u = tmp.se, val = tmp.fi;
// cout << u << " " << val << '\n';
q.pop();
cnt[u]++;
if(cnt[u] != 2)
continue;
if(u == 0)
return val;
for(auto i : vt[u])
{
if(cnt[i.fi] != 2)
q.push({val + i.se, i.fi});
}
}
}
#ifdef SKY
int main()
{
// freopen(task".inp", "r", stdin);
// freopen(task".out", "w", stdout);
ios_base::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
vector<int> tmp = {0, 0, 3, 2}, tmp1 = {1, 2, 2, 4}, tmp2 = {2, 3, 1, 4}, tmp3 = {1, 3, 4};
cout << solve(5, tmp, tmp1, tmp2, tmp3);
return 0;
}
#endif // ONLINE_JUDGE
Compilation message
crocodile.cpp:2:14: fatal error: crocodilelib.h: No such file or directory
2 | #include "crocodilelib.h"
| ^~~~~~~~~~~~~~~~
compilation terminated.