이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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({d+e.cost,e.to});
}
}
}
return D[0];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |