답안 #630178

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
630178 2022-08-15T20:21:39 Z NintsiChkhaidze 악어의 지하 도시 (IOI11_crocodile) C++14
0 / 100
2 ms 2644 KB
#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std;
#define s second
#define pb push_back
#define f first

const int nn = 100005;
vector <pair<int,int> > v[nn];
int dis[nn];

int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){

    for (int i = 0; i < M; i++){
        v[R[i][0]].pb({R[i][1],L[i]});
        v[R[i][1]].pb({R[i][0],L[i]});
    }

    for (int i = 1; i < N; i++)
        dis[i] = 1e9;
    
    priority_queue< pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq;
    pq.push({0,0});
    dis[0] = 0;
    while(pq.size()){
        int x = pq.top().s,d = pq.top().f;
        pq.pop();
        if (dis[x] != d) continue;
        for (auto [to,w]: v[x]){
            if (dis[to] > d + w){
                dis[to] = d + w;
                pq.push({dis[to],to});
            }
        }
    }

    int ans = 0;
    for (int i = 0; i < K; i++)
        ans = max(ans, dis[P[i]]);
    return ans;
}


Compilation message

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:29:19: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   29 |         for (auto [to,w]: v[x]){
      |                   ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -