``````#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#define N 1006
#define fo(i) for(int i=1;i<=n;i++)
#define Fo(j) for(int j=1;j<=n;j++)
using namespace std;
const int M=2000005;
int n,k,tot,fa[N];
struct NODE{

int x,y;
}dian[N];
struct node{

int x,y;
double z;
bool operator <(const node &a){

return this->z <a.z;
}
}bian[M];
inline int read(){

int x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9'){
if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){
x=x*10+ch-'0';ch=getchar();}
return x*f;
}
inline double cal(int a,int b){

return (double)(sqrt((double)((dian[a].x-dian[b].x)*(dian[a].x-dian[b].x))+(double)((dian[a].y-dian[b].y)*(dian[a].y-dian[b].y))));
}
inline void init(){

for(int i=1;i<=n;i++) fa[i]=i;
fo(i) dian[i].x=read(),dian[i].y=read();
fo(i){

Fo(j){

if(i<j){

++tot;
bian[tot].x=i;
bian[tot].y=j;
bian[tot].z=cal(i,j);
}
}
}
sort(bian+1,bian+tot+1);
}
int find(int x){

if(fa[x]==x) return fa[x];
return find(fa[x]);
}
inline void kruskal(){

int cnt=0;
for(int i=1;i<=tot;i++){

if(fa[find(bian[i].x)]!=fa[find(bian[i].y)]){

cnt++;
fa[find(bian[i].x)]=fa[find(bian[i].y)];
}
if(cnt==n-k+1){

printf("%.2lf",bian[i].z);
return ;
}
}
}
int main(){

n=read();k=read();
init();
kruskal();
return 0;
}
``````

2022-12-05 17:51

2022-12-26 18:01

2022-12-20 17:21

2022-12-16 16:59

2022-12-24 08:34

2022-12-08 09:51

2022-12-05 22:03

2022-12-15 14:39