# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
112539 | nxteru | Crocodile's Underground City (IOI11_crocodile) | C++14 | 850 ms | 72840 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;
typedef long long ll;
typedef pair<ll,ll> P;
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
ll f[100005],s[100005];
vector<P>g[100005];
int travel_plan(int n, int m, int R[][2], int L[], int k, int T[]){
for(int i=0;i<m;i++){
ll a=R[i][0],b=R[i][1],c=L[i];
g[a].PB(P(b,c));
g[b].PB(P(a,c));
}
for(int i=0;i<n;i++)f[i]=INF,s[i]=INF;
priority_queue<P,vector<P>,greater<P>>dik;
for(int i=0;i<k;i++){
ll v=T[i];
f[v]=0;
s[v]=0;
dik.push(P(0,v));
}
while(!dik.empty()){
ll c=dik.top().F,v=dik.top().S;
dik.pop();
if(s[v]<c)continue;
for(int i=0;i<g[v].size();i++){
ll u=g[v][i].F,p=c+g[v][i].S;
if(f[u]>p)swap(f[u],p);
if(s[u]>p){
s[u]=p;
dik.push(P(p,u));
}
}
}
return s[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... |