This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#define ll long long
#include <bits/stdc++.h>
#include "cyberland.h"
using namespace std;
const ll N=1e5+9;
pair<ll,ll>p;
double ans=-1;
ll vis[N],dis[N];
vector<pair<ll,ll>>v[N];
priority_queue<pair<ll,ll>>q;
double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) {
for(auto &i:dis)i=1e18;
for(ll i=0;i<M;++i)
{
v[x[i]].push_back({c[i],y[i]});
v[y[i]].push_back({c[i],x[i]});
}
q.push({0,0});
while(q.size())
{
p=q.top();
q.pop();
if(vis[p.second])continue;
vis[p.second]=1;
for(auto i:v[p.second])
{
if(dis[p.second]+i.second<dis[i.first])
{
dis[i.first]=dis[p.second]+i.second;
q.push({-dis[i.first],i.first});
}
}
}
if(dis[H]<1e18)ans=dis[H];
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |