#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define pll pair<ll, ll>
const ll sz=1e5+5, inf=1e18;
ll c[sz][2LL], used[sz];
vector<pll>g[sz];
priority_queue<pll, vector<pll>, greater<pll>>q;
/*
{} []
*/
int travel_plan(int n, int m, int r[][2], int l[], int k, int p[])
{
for(int i=0; i<m; i++){
ll u=r[i][0], v=r[i][1];
g[u].push_back({v, l[i]});
g[v].push_back({u, l[i]});
}
for(int i=0; i<n; i++){
c[i][0]=inf;
c[i][1]=inf;
}
for(int i=0; i<k; i++){
c[p[i]][0]=0;
c[p[i]][1]=0;
q.push({0, p[i]});
}
while(q.size()){
ll u=q.top().second, dis=q.top().first;
q.pop();
used[u]=1;
if(dis>=inf) continue;
for(auto i:g[u]){
ll v=i.first, w=i.second;
if(!used[v]){
if(dis+w<c[v][0]){
c[v][1]=c[v][0];
c[v][0]=dis+w;
}
else c[v][1]=min(c[v][1], dis+w);
q.push({c[v][1], v});
}
}
}
return c[0][1];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
8792 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
8792 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
8792 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |