이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
vector <long long> cost (200001,1e18);
vector <long long> secondcost (200001,1e18);
vector <long long> from(200001,1e18);
vector<pair<long long,long long>> adj[200001];
int d(int k,int P[]){
    priority_queue<pair<long long,long long>> q1;
    for(int i = 0;i<k;i++){
        q1.push({0,P[i]});
        cost[P[i]]= 0;
        secondcost[P[i]]= 0;
    }
    while(!q1.empty()){
        long long co = q1.top().first*-1;
        long long no = q1.top().second;
        q1.pop();
        if (co>secondcost[no]) continue ;
        for(int i= 0;i<adj[no].size();i++){
            if(secondcost[adj[no][i].first]>(adj[no][i].second+secondcost[no])){
                if((adj[no][i].second+secondcost[no])<=cost[adj[no][i].first]){
                if(from[adj[no][i].first]!=no){
                    secondcost[adj[no][i].first] = cost[adj[no][i].first];
                }
                cost[adj[no][i].first] = (adj[no][i].second+secondcost[no]);
                from[adj[no][i].first] = no;
                q1.push({secondcost[adj[no][i].first]*-1,adj[no][i].first});
                }else if(from[adj[no][i].first]!=no){
                secondcost[adj[no][i].first] = (adj[no][i].second+secondcost[no]);
                q1.push({secondcost[adj[no][i].first]*-1,adj[no][i].first});
                }
            }
        }
    }
    return secondcost[0];
}
long long 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]].push_back({R[i][1],L[i]});
        adj[R[i][1]].push_back({R[i][0],L[i]});
    }
    return d(K,P);
}
/*
signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int N = 5 , M = 7, K = 2;
    int R[4][2];
    R[0][0] = 0;R[0][1] = 1;
    R[1][0] = 0;R[1][1] = 2;
    R[2][0] = 3;R[2][1] = 2;
    R[3][0] = 2;R[3][1] = 4;
    int L[4] = {2,3,1,4};
    int P[3] = {1,3,4};
    cout<<travel_plan(N,M,R,L,K,P);
}*/
컴파일 시 표준 에러 (stderr) 메시지
crocodile.cpp: In function 'int d(int, int*)':
crocodile.cpp:20:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |         for(int i= 0;i<adj[no].size();i++){
      |                      ~^~~~~~~~~~~~~~~| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |