Submission #989699

# Submission time Handle Problem Language Result Execution time Memory
989699 2024-05-28T15:14:43 Z vjudge2 Crocodile's Underground City (IOI11_crocodile) C++17
0 / 100
1 ms 4444 KB
#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define pii pair<int, int>
 
const ll INF = 1e18;
 
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) {
    vector<vector<pii>> adj(N);
    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]});
    }
    priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<>> q;
    vector<int> cnt(N, 0);
    vector<ll> di(N, INF);
    for (int i = 0; i < K; i++) {
        cnt[P[i]] = 2, di[P[i]] = 0;
        q.push({0, P[i]});
    }
    while (!q.empty()) {
        auto [dist, u] = q.top();
        q.pop();
        cnt[u]++;
        if (cnt[u] == 2) di[u] = dist;
        if (cnt[u] != 2 || di[u] != dist) continue;
        for (auto& [v, w] : adj[u]) {
            if (cnt[v] < 2 && di[v] > di[u] + w) {
                q.push({di[u] + w, v});
            }
        }
    }
    return di[0];
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -