#include #include #include #include #include #include #include #include #include #include #include //#include using namespace std; using ll = long long; template< typename T > struct edge{ int from,to; T cost; edge(int from,int to, T cost):from(from),to(to),cost(cost){}; edge &operator=(const int& x){ to = x; return *this; } }; template< typename T > struct graph{ int n; vector>> e; graph(int n):n(n),e(n){} void addedge(int from,int to,T cost){ e[from].emplace_back(from,to,cost); } vector> &operator[](int i) { return e[i]; } }; /* * O(ElogV) * 蛻ー驕比ク崎・縺ョ蝣エ蜷医・窶・縺悟・縺」縺ヲ繧九€・ */ template< typename T > vector dijkstra(graph& g, int st){ int n = g.n; using pt = pair; vector dist(n,-1); dist[st] = 0; priority_queue, greater>que; que.emplace(0,st); while(que.size()){ int ni; T cost; tie(cost,ni) = que.top(); que.pop(); if(dist[ni] itr:g[ni]){ int nxt = itr.to; if(dist[nxt]>cost+itr.cost||dist[nxt]==-1){ dist[nxt] = cost + itr.cost; que.emplace(dist[nxt],nxt); } } } return dist; }; int main(){ int n,k,sx,sy,gx,gy; cin>>n>>k>>sx>>sy>>gx>>gy; vector x(n),y(n); for(int i = 0;i>x[i]>>y[i]; ll right = 1e9; ll left = 0; while(right-left>1){ ll mid = (right+left)/2; graph g(n+2); int s = n; int t = s + 1; for(int i = 0;i(g,s)[t]; if(can<=k) right = mid; else left = mid; } cout<