#include "cyberland.h"
#include <bits/stdc++.h>
#include "stub.cpp"
using namespace std;
const int N=1e5+10;
const long double inf=1e18;
int n,arr[N],k;
vector<pair<int,long long>> adj[N];
long double dist[N],MS=-1;
long double dyk(int s,int e)
{
for(int j=0;j<n;j++)
dist[j]=inf;
priority_queue<pair<long double,int>,vector<pair<long double,int>>,greater<pair<long double,int>>> pq;
dist[s]=0;
pq.push({dist[s],s});
while(pq.size())
{
auto tp=pq.top();
pq.pop();
if(tp.second==e) // this is cz we dont go other side of h
continue;
if(tp.first==dist[tp.second])
{
int v=tp.second;
for(auto [u,w]:adj[v])
{
if((dist[v]+w)<dist[u])
{
dist[u]=dist[v]+w;
pq.push({dist[u],u});
}
}
}
}
// cout<<"DY from "<<s<<endl;
// for(int pp=0;pp<n;pp++)
// {
// cout<<dist[pp]<<' ';
// }
// cout<<endl;
return ((dist[e]==inf)?MS:dist[e]);
}
long double dyk_comb(int e)
{
dyk(0,e);
priority_queue<pair<long double,int>,vector<pair<long double,int>>,greater<pair<long double,int>>> pq[k+1];
for(int j=0;j<n;j++)
{
if(dist[j]!=inf and (j==0 or arr[j]==0))
{
dist[j]=0;
pq[k].push({0,j});
}
else
dist[j]=inf;
}
for(int j=k;j>=0;j--)
{
while(pq[j].size())
{
auto tp=pq[j].top();
pq[j].pop();
if(tp.first==dist[tp.second])
{
// if(tp.second==e)
// {
// continue;
// }
int v=tp.second;
for(auto [u,w]:adj[v])
{
if((dist[v]+w)<dist[u])
{
dist[u]=dist[v]+w;
pq[j].push({dist[u],u});
}
}
if(arr[v]==2 and j>0)
{
dist[v]/=2;
pq[j-1].push({dist[v]/2.0,v});
}
}
}
}
return ((dist[e]==inf)?MS:dist[e]);
}
double solve(int NP, int m, int kp, int h, vector<int> x, vector<int> y, vector<int> c, vector<int> AS) {
n=NP;
k=kp;
for(int i=0;i<n;i++)
{
arr[i]=AS[i];
adj[i].clear();
}
for(int j=0;j<m;j++)
{
adj[x[j]].push_back({y[j],c[j]});
adj[y[j]].push_back({x[j],c[j]});
}
return dyk_comb(h);
}
Compilation message
cyberland.cpp:5:10: fatal error: stub.cpp: No such file or directory
5 | #include "stub.cpp"
| ^~~~~~~~~~
compilation terminated.