답안 #1007175

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1007175 2024-06-24T12:44:39 Z The_Samurai 악어의 지하 도시 (IOI11_crocodile) C++17
100 / 100
364 ms 65544 KB
#include "crocodile.h"
#include "bits/stdc++.h"
using namespace std;
const int inf = 2e9;

int travel_plan(int n, int m, int R[][2], int L[], int k, int p[]) {
    vector<vector<pair<int, int>>> g(n);
    for (int i = 0; i < m; i++) {
        g[R[i][0]].emplace_back(R[i][1], L[i]);
        g[R[i][1]].emplace_back(R[i][0], L[i]);
    }
    vector<int> height(n, -1);
    vector<pair<int, int>> out(n, make_pair(inf, inf));
    priority_queue<pair<int, int>> pq;
    vector<bool> vis(n);
    for (int i = 0; i < k; i++) {
        height[p[i]] = 0;
        pq.emplace(0, p[i]);
    }
    while (!pq.empty()) {
        auto [d, u] = pq.top(); pq.pop();
        if (vis[u]) continue;
        d *= -1;
        // cout << u << ' ' << d << endl;
        vis[u] = true;
        height[u] = d;
        for (auto [v, w]: g[u]) {
            if (vis[v]) continue;
            // cout << '\t' << u << ' ' << v << ' ' << w << endl;
            if (out[v].first > d + w) {
                out[v].second = out[v].first;
                out[v].first = d + w;
            } else {
                out[v].second = min(out[v].second, d + w);
            }
            if (out[v].second != inf) {
                pq.emplace(-out[v].second, v);
            }
        }
    }
    return height[0];
}


# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 0 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 0 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 2 ms 4700 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 3 ms 4956 KB Output is correct
13 Correct 3 ms 4956 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 0 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 2 ms 4700 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 3 ms 4956 KB Output is correct
13 Correct 3 ms 4956 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 348 ms 65544 KB Output is correct
17 Correct 41 ms 15956 KB Output is correct
18 Correct 52 ms 17236 KB Output is correct
19 Correct 364 ms 64288 KB Output is correct
20 Correct 254 ms 53956 KB Output is correct
21 Correct 22 ms 9308 KB Output is correct
22 Correct 233 ms 46420 KB Output is correct