이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "crocodile.h"
#include <bits/stdc++.h>
#define mp make_pair
#define pb emplace_back
#define fi first
#define se second
using namespace std;
vector<pair<int, int>> conn[100005];
int dist[100005];
int travel_plan(int n, int m, int r[][2], int l[], int k, int p[]){
    for(int i = 0; i < n; i++) dist[i] = -1;
    priority_queue<pair<int, int>, vector<pair<int, int>>, greater<>> dij;
    for(int i = 0; i < k; i++) {
        dist[p[i]] = 0;
        dij.push(mp(0, p[i]));
    }
    for(int i = 0; i < m; i++) {
        conn[r[i][0]].pb(mp(r[i][1], l[i]));
        conn[r[i][1]].pb(mp(r[i][0], l[i]));
    }
    while(!dij.empty()) {
        pair<int, int> now = dij.top();
        dij.pop();
        if(dist[now.se] > 0 && dist[now.se] <= now.fi) continue;
        if(dist[now.se] == -1) {
            dist[now.se] = -2;
            continue;
        }
        dist[now.se] = now.fi;
        for(auto x: conn[now.se]) {
            if(dist[x.fi] < 0 || dist[x.fi] > now.fi + x.se) {
                dij.push(mp(x.se + now.fi, x.fi));
            }
        }
    }
    return dist[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... |