이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#include "crocodile.h"
#define pb push_back
#define fi first
#define se second
const int nax=1e5+5;
vector<pair<int,int>> adj[nax];
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
  for (int i = 0; i < M; ++i)
  {
    adj[R[i][0]].pb({R[i][1],L[i]});
    adj[R[i][1]].pb({R[i][0],L[i]});
  }
  priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq;
  int vis[N];
  memset(vis,0,sizeof vis);
  for (int i = 0; i < K; ++i)
  {
    pq.push({0,P[i]});
    vis[P[i]]++;
  }
  while(!pq.empty()){
    pair<int,int> node=pq.top();
    pq.pop();
    if(vis[node.se]++ == 1){
      if(node.se==0) return node.fi;
      for(auto u:adj[node.se]){
        pq.push({u.se+node.fi,u.fi});
      }
    }
  }
  return N;
}
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |