# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
471877 | 2021-09-11T11:04:01 Z | dooompy | Crocodile's Underground City (IOI11_crocodile) | C++17 | 1 ms | 204 KB |
#include "crocodile.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; int seen[100005]; int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { vector<vector<pair<int, int>>> 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<pair<ll, int>>> pq; for (int i = 0; i < K; i++) { pq.push({0, P[i]}); seen[i] = 1; } while (!pq.empty()) { auto curdist = pq.top().first; auto node = pq.top().second; pq.pop(); if (!seen[node]) { seen[node] = 1; continue; } if (seen[node] == 2) continue; if (node == 0) { return curdist; } seen[node] = 2; for (auto a : adj[node]) { if (seen[a.first] != 2) { pq.push({curdist + a.second, a.first}); } } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |