답안 #911266

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
911266 2024-01-18T17:23:26 Z codefox 악어의 지하 도시 (IOI11_crocodile) C++14
100 / 100
707 ms 76984 KB
#include<bits/stdc++.h>
#include "crocodile.h"
    
using namespace std;

#define pii pair<int, int>

int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
    vector<vector<pii>> graph(N);
    vector<int> alt(N, 0);
    vector<int> low(N, 1e9);
    for (int i = 0; i < M; i++)
    {
        graph[R[i][0]].push_back({R[i][1], L[i]});
        graph[R[i][1]].push_back({R[i][0], L[i]});
    }
    priority_queue<pii, vector<pii>, greater<pii>> pq;
    for (int i = 0; i < K; i++)
    {
        pq.push({0, P[i]});
        alt[P[i]]=1;
    }
    
    while(pq.size())
    {
        int i, d;
        tie(d, i) = pq.top();
        pq.pop();
        if (!alt[i])
        {
            alt[i]=1;
            continue;
        }
        if (low[i]!=1e9) continue;
        low[i] = d;
        for (pii ele:graph[i])
        {
            pq.push({d+ele.second, ele.first});
        }
    }
    return low[0];
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4468 KB Output is correct
4 Correct 2 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 2 ms 4444 KB Output is correct
7 Correct 2 ms 4440 KB Output is correct
8 Correct 2 ms 4444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4468 KB Output is correct
4 Correct 2 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 2 ms 4444 KB Output is correct
7 Correct 2 ms 4440 KB Output is correct
8 Correct 2 ms 4444 KB Output is correct
9 Correct 4 ms 4952 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 2 ms 4700 KB Output is correct
12 Correct 6 ms 5192 KB Output is correct
13 Correct 5 ms 5212 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 2 ms 4444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4468 KB Output is correct
4 Correct 2 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 2 ms 4444 KB Output is correct
7 Correct 2 ms 4440 KB Output is correct
8 Correct 2 ms 4444 KB Output is correct
9 Correct 4 ms 4952 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 2 ms 4700 KB Output is correct
12 Correct 6 ms 5192 KB Output is correct
13 Correct 5 ms 5212 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 2 ms 4444 KB Output is correct
16 Correct 627 ms 74028 KB Output is correct
17 Correct 64 ms 15480 KB Output is correct
18 Correct 93 ms 16992 KB Output is correct
19 Correct 707 ms 76984 KB Output is correct
20 Correct 508 ms 64392 KB Output is correct
21 Correct 34 ms 9004 KB Output is correct
22 Correct 434 ms 46808 KB Output is correct