| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 402706 | Antekb | 악어의 지하 도시 (IOI11_crocodile) | C++14 | 817 ms | 61560 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>
using namespace std;
#define st first
#define nd second
#define mp(x, y) make_pair(x ,y)
typedef long long ll;
const ll INF=1e18;
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
	ll dist[N], dist2[N];
	vector<pair<int, int> > E[N];
	for(int i=0; i<M; i++){
		E[R[i][0]].push_back(mp(R[i][1], L[i]));
		E[R[i][1]].push_back(mp(R[i][0], L[i]));
	}
	for(int i=0; i<N;i++)dist[i]=dist2[i]=INF;
	for(int i=0; i<K; i++)dist[P[i]]=dist2[P[i]]=0;
	set<pair<ll, int> > S;
	for(int i=0;i<N; i++){
		S.insert(mp(dist[i], i));
	}
	while(S.size()){
		int v=(*S.begin()).nd;
		S.erase(S.begin());
		if(v==0){
			return dist[v];
		}
		for(auto i:E[v]){
			if(dist[v]+i.nd<dist[i.st]){
				S.erase(S.find(mp(dist[i.st], i.st)));
				if(dist[v]+i.nd>dist2[i.st])dist[i.st]=dist[v]+i.nd;
				else{
					dist[i.st]=dist2[i.st];
					dist2[i.st]=dist[v]+i.nd;
				}
				S.insert(mp(dist[i.st], i.st));
			}
		}
	}
}
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... | ||||
