| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 519950 | sliviu | Crocodile's Underground City (IOI11_crocodile) | C++17 | 461 ms | 71084 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>
using namespace std;
using ll = long long;
using pi = pair<int, int>;
int travel_plan(int n, int m, int r[][2], int l[], int k, int p[]) {
	vector<vector<pair<int, int>>> G(n);
	vector<int> seen(n);
	for (int i = 0;i < m;++i) {
		int x, y;
		G[r[i][0]].emplace_back(r[i][1], l[i]);
		G[r[i][1]].emplace_back(r[i][0], l[i]);
	}
	auto comp = [&](pi a, pi b) {
		return a.second > b.second;
	};
	priority_queue<pi, vector<pi>, decltype(comp)> PQ(comp);
	for (int i = 0;i < k;++i) {
		PQ.emplace(p[i], 0);
		++seen[p[i]];
	}
	while (!PQ.empty()) {
		int node, cost;
		tie(node, cost) = PQ.top();
		PQ.pop();
		if (++seen[node] == 2) {
			if (node == 0)
				return cost;
			for (auto x : G[node])
				PQ.emplace(x.first, x.second + cost);
		}
	}
}
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... | ||||
