# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
976537 | marinaluca | Crocodile's Underground City (IOI11_crocodile) | C++17 | 414 ms | 72256 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "crocodile.h"
using namespace std;
int travel_plan(int N, int M, int R[][2], int L[], int k, int P[]){
vector <vector<pair<int, int>>> ans(N);
for (int i = 0; i < M; ++ i){
int a = R[i][0], b = R[i][1];
ans[a].emplace_back(b, L[i]);
ans[b].emplace_back(a, L[i]);
}
vector <int> v(N);
priority_queue<pair<int, int>> pq;
for (int i = 0; i < k; ++ i){
v[P[i]] ++;
pq.emplace(0, P[i]);
}
while (!pq.empty()){
auto [x, y] = pq.top();
pq.pop();
if (v[y] ++ == 1){
if (y == 0)
return -x;
for (auto &[xx, yy] : ans[y]){
pq.emplace(x - yy, xx);
}
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |