# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
363655 | David_M | Crocodile's Underground City (IOI11_crocodile) | C++14 | 652 ms | 72924 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 F first
#define S second
#define ll long long
#define pll pair<ll, ll>
using namespace std;
const ll INF=1e18, N=100005;
ll d,x,o,i;
pll D[N];
vector<pll>v[N];
priority_queue<pll>q;
int travel_plan(int n,int m,int R[][2],int L[],int k,int p[]){
for(i=0;i<m;i++)
v[R[i][0]].push_back({R[i][1],L[i]}),
v[R[i][1]].push_back({R[i][0],L[i]});
for(i=0;i<n;i++)D[i]={INF,INF};
for(i=0;i<k;i++)D[p[i]]={0,0},q.push({0,p[i]});
while(!q.empty()){
auto[d,x]=q.top();
q.pop();
if(-d>D[x].F)continue;
for (auto[y,l]:v[x]){
o=D[y].F;
if(D[y].F>l-d)D[y].F=l-d;
if(D[y].F<D[y].S)swap(D[y].F,D[y].S);
if(D[y].F!=o)q.push({-D[y].F,y});
}
}
return D[0].F;
}
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... |