이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "crocodile.h"
#include <bits/stdc++.h>
int travel_plan(int n, int m, int R[][2], int L[], int k, int P[]) {
  std::vector<std::vector<std::array<int, 2>>> g(n);
  for (int i = 0; i < m; ++i) {
    g[R[i][0]].push_back({R[i][1], L[i]});
    g[R[i][1]].push_back({R[i][0], L[i]});
  }
  std::vector<int> d(n), vis(n);
  std::priority_queue<std::array<int, 2>, std::vector<std::array<int, 2>>, std::greater<std::array<int, 2>>> pq;
  for (int i = 0; i < k; ++i) {
    int u = P[i];
    vis[u] = 1;
    pq.push({0, u});
  }
  while (pq.size()) {
    auto [c, u] = pq.top(); pq.pop();
    if (vis[u] == 2) {
      continue;
    }
    if (++vis[u] == 2) {
      d[u] = c;
      for (auto [v, w] : g[u]) {
        pq.push({c + w, v});
      }
    }
  }
  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... |