# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
298695 | eohomegrownapps | Sky Walking (IOI19_walk) | C++14 | 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 "walk.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<pair<ll,int>> adjlist[10000000]; // weight, node
ll INF = 1e18;
ll dijkstra(int n, int a, int b){
ll distance[10000000]={1e18};
distance[a]=0;
priority_queue<pair<ll,int>,vector<pair<ll,int>>,greater<pair<ll,int>>> pq;
pq.push({0,a});
while (pq.size()>0){
auto f = pq.top();
pq.pop();
if (f.first>distance[f.second]){continue;}
for (auto p : adjlist[f.second]){
if (distance[f.second]+p.first<distance[p.second]){
distance[p.second]=distance[f.second]+p.first;
pq.push({distance[p.second],p.second});
}
}
}
return (distance[b]==INF)?-1:distance[b];
}
long long min_distance(std::vector<int> x, std::vector<int> h, std::vector<int> l, std::vector<int> r, std::vector<int> y, int s, int g) {