1 #include<iostream>
2 #include<algorithm>
3 #include<cmath>
4 #include<iomanip>
5 using namespace std;
6
7 int fa[501];
8
9 int find(int x)
10 {
11 if (x == fa[x]) return x;
12 fa[x] = find(fa[x]);
13 return fa[x];
14 }
15
16 struct Edge
17 {
18 int u;
19 int v;
20 double w;
21 bool operator <(Edge s)
22 {
23 return w < s.w;
24 }
25 }e[300010];
26
27 int n, lim;
28 int cnt;
29 pair<int, int>node[501];
30
31 int main()
32 {
33 cin >> lim >> n;
34 for (int i = 1; i <= n; i++)
35 {
36 fa[i] = i;
37 cin >> node[i].first >> node[i].second;
38 }
39 for (int i = 1; i <= n; i++)
40 {
41 for (int j = i + 1; j <= n; j++)
42 {
43 double dis = sqrt(pow(node[i].first - node[j].first, 2) + pow(node[i].second - node[j].second, 2));
44 e[++cnt].w = dis;
45 e[cnt].u = i;
46 e[cnt].v = j;
47 }
48 }
49 sort(e + 1, e + cnt + 1);
50 int tot = 1;
51 double maxd = -1;
52 lim = n - lim;
53 for (int i = 1; i <= cnt && lim; i++)
54 {
55 if (find(e[i].u) != find(e[i].v))
56 {
57 fa[find(e[i].u)] = e[i].v;
58 maxd = max(maxd, e[i].w);
59 lim--;
60 }
61 }
62 cout << fixed << setprecision(2) << maxd;
63 }