#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std;
struct edge{
int to,cost;
};
vector<edge>E[100000];
int C[100000];
long long D[100000];
priority_queue<pair<long long,int>,vector<pair<long long,int>>,greater<pair<long long,int>>>pq;
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){
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]});
}
for(int i=0;i<K;i++){
pq.push({0,P[i]});
pq.push({0,P[i]});
}
while(!pq.empty()){
int x=pq.top().second;
long long d=pq.top().first;
pq.pop();
C[x]++;
if(C[x]==2){
D[x]=d;
for(edge e:E[x]){
pq.push({e.to,d+e.cost});
}
}
}
return D[0];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2816 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2816 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2816 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |