#include using namespace std; #define all(v) (v).begin(),(v).end() #define pb(a) push_back(a) #define rep(i, n) for(int i=0;i vector dijkstra(T &G, int start){ using P = pair; int n = G.size(); vector dis(n, MOD7); dis[start] = 0; priority_queue, greater

> Q; Q.push({0, start}); while(!Q.empty()){ P p = Q.top(); Q.pop(); int cur = p.second; if(dis[cur] < p.first) continue; for(auto e : G[cur]) { if(dis[e.second] > dis[cur] + e.first) { dis[e.second] = dis[cur] + e.first; Q.push({dis[e.second], e.second}); } } } return dis; } int main() { cin.tie(0); ios::sync_with_stdio(false); int n, k; cin >> n >> k; vector x(n + 2), y(n + 2); cin >> x[0] >> y[0] >> x[1] >> y[1]; for(int i = 2; i <= n + 1; i ++) cin >> x[i] >> y[i]; auto calc = [&](int i, int j, int num) -> int { int dis = abs(x[i] - x[j]) + abs(y[i] - y[j]); return (dis - 1) / num; }; int le = 0, ri = 100000000; while(ri - le > 1) { vector>> v(n + 2); int mid = (ri + le) / 2; rep(i, n + 2) rep(j, n + 2) { if(i == j) continue; v[i].push_back({calc(i, j, mid), j}); } if(dijkstra(v, 0)[1] <= k) ri = mid; else le = mid; } cout << ri << endl; return 0; }