답안 #164344

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
164344 2019-11-19T12:39:38 Z dantoh000 악어의 지하 도시 (IOI11_crocodile) C++14
100 / 100
793 ms 61428 KB
#include <bits/stdc++.h>
//#include "crocodile.h"
using namespace std;
typedef pair<int,int> ii;
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
    vector<ii> adjlist[N];
    for (int i = 0; i < M; i++){
        adjlist[R[i][0]].push_back(ii(R[i][1],L[i]));
        adjlist[R[i][1]].push_back(ii(R[i][0],L[i]));
    }
    priority_queue<ii,vector<ii>, greater<ii> > pq;
    int bist[N], dist[N];
    memset(bist,-1,sizeof(bist));
    memset(dist,-1,sizeof(dist));
    for (int i = 0; i < K; i++){
        dist[P[i]] = 0;
        pq.push(ii(0,P[i]));
    }
    while (pq.size()){
        ii cur = pq.top(); pq.pop();
        int d = cur.first, u = cur.second;
        if (dist[u] < d) continue;
        //printf("%d %d\n",d,u);
        for (auto v : adjlist[u]){
            if (bist[v.first] == -1){
                bist[v.first] = v.second + dist[u];
            }
            else{
                if (dist[v.first] == -1 || dist[v.first] > max(dist[u]+v.second,bist[v.first])){
                    dist[v.first] = max(dist[u]+v.second,bist[v.first]);
                    pq.push(ii(dist[v.first],v.first));
                }
                bist[v.first] = min(bist[v.first],dist[u]+v.second);
            }
        }
    }
    return dist[0];
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 1 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 3 ms 504 KB Output is correct
5 Correct 3 ms 504 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 3 ms 504 KB Output is correct
8 Correct 3 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 1 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 3 ms 504 KB Output is correct
5 Correct 3 ms 504 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 3 ms 504 KB Output is correct
8 Correct 3 ms 504 KB Output is correct
9 Correct 4 ms 760 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 6 ms 888 KB Output is correct
13 Correct 6 ms 760 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 1 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 3 ms 504 KB Output is correct
5 Correct 3 ms 504 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 3 ms 504 KB Output is correct
8 Correct 3 ms 504 KB Output is correct
9 Correct 4 ms 760 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 6 ms 888 KB Output is correct
13 Correct 6 ms 760 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
16 Correct 595 ms 56052 KB Output is correct
17 Correct 102 ms 13944 KB Output is correct
18 Correct 122 ms 15396 KB Output is correct
19 Correct 793 ms 61428 KB Output is correct
20 Correct 365 ms 47352 KB Output is correct
21 Correct 50 ms 6136 KB Output is correct
22 Correct 459 ms 44480 KB Output is correct