# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
29360 | aybala | Crocodile's Underground City (IOI11_crocodile) | C++11 | 396 ms | 123848 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 fori(a,b,c) for(a=b; a<c; a++)
#define ford(a,b,c) for(a=b; a>=c; a--)
#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define fi first
#define se second
#define fr front
#define emp empty
#define pq priority_queue
#define pll pair<long,long>
using namespace std;
vector< pii >v[100005];
int ex[100005];
pq< pii >q;
int dis[100005];
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){
int i,j,k;
fori(i,0,N){
v[R[i][0]].pb(mp(L[i],R[i][1]));
v[R[i][1]].pb(mp(L[i],R[i][0]));
dis[i]=-1;
}
fori(i,0,K){
ex[P[i]]=1;
dis[P[i]]=0;
q.push(mp(0,P[i]));
}
while(!q.empty()){
int t=q.top().se;
int s=v[t].size();
q.pop();
fori(i,0,s){
if(ex[v[t][i].se]){
if(dis[v[t][i].se]>dis[t]+v[t][i].fi || dis[v[t][i].se]==-1){
dis[v[t][i].se]=dis[t]+v[t][i].fi;
q.push(mp(-dis[v[t][i].se],v[t][i].se));
}
}
ex[v[t][i].se]++;
}
}
return dis[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... |