# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
29490 | Nikefor | Crocodile's Underground City (IOI11_crocodile) | C++98 | 0 ms | 0 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 ii pair<int,int>
using namespace std;
int visit[100002];
int res;
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
priority_queue<ii, vector<int>, greater<int> > q;
vector<ii> adj[N+2];
for(int i=0; i<K; i++) q.push(make_pair(0,P[i]));
while(!q.empty()) {
ii e = q.top();
int v = e.second;
q.pop;
if(!visit[v]) {
visit++;
continue;
}
visit++;
if(!v){
res = e.first;
break;
}
for(int i=0; i<adj[v].size(); i++) {
if(visit[adj[v].first]<2) q.push(make_pair(e.first+L[adj[v].second], adj[v].first ));
}
}
return res;
}