https://www.luogu.org/problem/P1991
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;
const int MN=1000005;
int m,n,cnt,fa[505];
struct cyq{
int u,v;
double s;
}a[MN];
double b[505][2],ans;
double Search(int k,int l){
return sqrt((b[k][0]-b[l][0])*(b[k][0]-b[l][0])+(b[k][1]-b[l][1])*(b[k][1]-b[l][1]));
}
bool cmp(cyq aa,cyq bb){
return aa.s<bb.s;
}
int find(int u){
if(fa[u]==u) return u;
return fa[u]=find(fa[u]);
}
void init(){
cin>>m>>n;
for(int i=1;i<=n;i++)
cin>>b[i][0]>>b[i][1];
for(int i=1;i<n;i++)
for(int j=i+1;j<=n;j++){
a[++cnt].u=i;
a[cnt].v=j;
a[cnt].s=Search(i,j);
}
for(int i=1;i<=n;i++) fa[i]=i;
sort(a+1,a+1+cnt,cmp);/*
for(int i=1;i<=cnt;i++)
printf("%.2f\n",a[i].s);*/
}
void work(){
int count=0;
for(int i=1;i<=cnt;i++){
int fu=find(a[i].u),fv=find(a[i].v);
if(fu==fv) continue;
ans=max(ans,a[i].s);
fa[fu]=fv;
++count;
if(count==n-m)
break;
}
printf("%.2f\n",ans);
}
int main(){
init();
work();
return 0;
}