| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 465521 | MohamedFaresNebili | Crocodile's Underground City (IOI11_crocodile) | C++14 | 543 ms | 66872 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<pair<int, int>>adj[N]; vector<int> d(N, 0);
	priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>>pq;
	for(int l=0;l<M;l++) {
		int a=R[l][0], b=R[l][1], w=L[l];
		adj[a].push_back({b, w});
		adj[b].push_back({a, w});
	}
	for(int l=0;l<K;l++) {
		int a=P[l]; d[a]=1; pq.push({0, a});
	}
	vector<bool>vis(N, false);
	while(!pq.empty()) {
		int a=pq.top().second, w=pq.top().first; pq.pop();
		if(d[a]==0) { d[a]=1; continue; }
		if(vis[a]) continue; vis[a]=true;
		if(a==0) return w;
		for(auto u:adj[a]) {
			int to=u.first, s=u.second;
			if(vis[to]) continue;
			pq.push({w+s, to});
		}
	}
	return -1;
}
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... | ||||
