#include #include #include #include #include #include using std::vector; using std::pair; struct Vertex { int a; int b; double l; static int compare(Vertex &a, Vertex &b) { return (a.l < b.l); } void print() { std::cout << a << ";" << b << " " << l << std::endl; } }; struct Point { int x; int y; int parent; void print() { std::cout << x << ";" << y << " " << parent << std::endl; } }; struct Points { vector points; vector vertices; Points(int n) : points(n), vertices(n*n) { } void read(int i) { std::cin >> points[i].x >> points[i].y; points[i].parent = i; } void print() { for (int i = 0; i < points.size(); i++) points[i].print(); } int find(int i) { if (points[i].parent == i) return i; points[i].parent = find(points[i].parent); return points[i].parent; } double solve(int k) { int x = 0; for (int i = 0; i < points.size(); i++) { for (int j = i + 1; j < points.size(); j++) { vertices[x].a = i; vertices[x].b = j; vertices[x].l = sqrt( (points[i].x - points[j].x) * (points[i].x - points[j].x) + (points[i].y - points[j].y) * (points[i].y - points[j].y) ); x += 1; } } vertices.resize(x); std::sort(vertices.begin(), vertices.end(), Vertex::compare); int n = 0; double result = 0.; for (int i = 0; i < vertices.size(); i++) { int realA = find(vertices[i].a); int realB = find(vertices[i].b); if (realA != realB) { if (n == points.size() - k) { result = vertices[i].l; break; } n += 1; points[realB].parent = realA; } } return result; } }; int main() { size_t n; int k; std::cin >> n; Points points(n); for (size_t i = 0; i < n; i++) points.read(i); std::cin >> k; std::cout << std::setprecision(10) << points.solve(k) << std::endl; }