| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 786062 | KN200711 | 악어의 지하 도시 (IOI11_crocodile) | C++14 | 413 ms | 100968 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 "crocodile.h"
# include <bits/stdc++.h>
# define ll long long
# define fi first
# define se second
using namespace std;
bool vis[100001], ct[100001];
ll nw[100001];
vector<pair<int, ll> > edge[100001];
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) {
	for(int i=0;i<N;i++) {
		vis[i] = 0;
		ct[i] = 0;
		edge[i].clear();
	}
	for(int i=0;i<M;i++) {
		edge[R[i][0]].push_back(make_pair(R[i][1], L[i]));
		edge[R[i][1]].push_back(make_pair(R[i][0], L[i]));
	}
	for(int i=0;i<K;i++) vis[P[i]] = 1;
	
	priority_queue< pair<ll, int> > PQ;
	for(int i=0;i<K;i++) {
		for(int c=0;c<edge[P[i]].size();c++) {
			PQ.push(make_pair(-edge[P[i]][c].se, edge[P[i]][c].fi));
		}
	}
	
	while(!PQ.empty()) {
		ll a = -PQ.top().fi;
		int b = PQ.top().se;
		PQ.pop();
		
		if(vis[0]) break;
		if(vis[b]) continue;
		if(ct[b]) {
			nw[b] = a;
			vis[b] = 1;
			for(int k=0;k<edge[b].size();k++) {
				if(!vis[edge[b][k].fi]) PQ.push(make_pair(-a-edge[b][k].se, edge[b][k].fi));
			}
		} else ct[b] = 1;
	}
	
	return nw[0];
}
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... | ||||
