이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include"crocodile.h"
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define vl vector<ll>
#define vi vector<int>
#define all(v) v.begin(), v.end()
#define pb push_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define f first
#define s second
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int sz = 1e5+5;
vector<pii>g[sz];
int vis[sz], e[sz], k = 0, i;
ll dist[sz], res = 0;
priority_queue<pll>pq;
void dijkstra()
{
    while(!pq.empty())
    {
        ll dist = pq.top().f;
        ll node = pq.top().s;
        pq.pop();
        vis[node]++;
        if(vis[node] == 2){
            if(node == 0)
            {
                res = -dist;
                return;
            }
            for(auto [u, w] : g[node])
                pq.push({dist - w, u});
        }
    }
}
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
    res = 0;
    for(i = 0; i < M; i++)
    {
        g[R[i][0]].pb({R[i][1], L[i]});
        g[R[i][1]].pb({R[i][0], L[i]});
    }
    for(i = 0; i < K; i++)
    {
      	vis[P[i]] = 1;
      	pq.push({0, P[i]});
    }
  	dijkstra();
    return res;
}
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |