ll@n,@k,x[n+2],y[]; rd((x,y)(n+2)); priority_queue>>h; rep(i,n+2){ rep(j,n+2){ h.push({-(abs(x[j]-x[i])+abs(y[j]-y[i])),{i,j}}); } } priority_queue>>q; unionFind u('m',n+2,1); while(u(0)!=u(1)){ auto a=h.top(); h.pop(); if(u(a.second.first,a.second.second)){ q.push({-a.first,{-a.first,1}}); } } rep(k){ auto a=q.top(); q.pop(); q.push({a.second.first/+(a.second.second+1),{a.second.first,a.second.second+1}}); } wt(q.top().first);