Arctic Network
Time limit1sMemory limit128 MB
Given P outposts and S satellite channels, find the minimum radio range D so that all outposts stay connected, where satellite-linked outposts communicate freely.
- Level
Medium7 of 10
- Topics
- Minimum spanning tree, Union-find, Graph, Greedy
- Solved
- No attempts yet
Problem
The Department of National Defence (DND) wants to connect several northern outposts with a wireless network. Two communication technologies are used to build the network: every outpost is equipped with a radio transceiver, and some outposts additionally have a satellite channel.
Any two outposts that both have a satellite channel can communicate through the satellite, no matter where they are located. Otherwise, two outposts can communicate by radio only if the distance between them is at most , which depends on the transmitter power. Higher power gives a larger but costs more. For purchasing and maintenance reasons the transceivers at all outposts must be identical; that is, the value of is the same for every pair of outposts.
Determine the minimum such that every pair of outposts is connected by at least one communication path, whether direct or indirect.
Input
The first line contains the number of test cases . For each test case, the first line contains the number of satellite channels and the number of outposts (, ). The next lines each contain the coordinates of an outpost in kilometres. Each coordinate is an integer between and inclusive.
Output
For each test case, output on a single line the minimum required to connect the network. Print the value to two decimal places.