#P1991. Wireless Network Connection
Wireless Network Connection
Wireless Network Connection
The Ministry of National Defense plans to connect several border outposts using a wireless network. Two different communication technologies are employed:
- Every outpost is equipped with a radio transceiver.
- Some outposts can be additionally fitted with a satellite phone.
Any two outposts both equipped with a satellite phone can communicate regardless of the distance between them. However, for two outposts relying solely on their radio transceivers, the communication distance cannot exceed \(D\) (this limit is imposed by the transceivers' power). Since the transceivers are purchased and installed uniformly in all outposts, a single model is used, and hence the radio link range \(D\) is identical for every pair.
Your task is to determine the minimum required radio transceiver range \(D\) so that there exists at least one communication path (direct or via intermediate outposts) between every pair of outposts. In other words, through radio links (if the distance between two connected outposts is not more than \(D\)) and the free long‐range satellite links (available only between outposts with satellite phones), the entire network must be connected.
Note: You are given the number of available satellite channels (which is the number of outposts that can be equipped with a satellite phone) and the positions of the outposts. This is similar to the well known "Arctic Network" problem.
inputFormat
The input begins with an integer representing the number of test cases. Each test case is described as follows:
- The first line of a test case contains two integers: \(S\) and \(P\) where \(S\) (\(1 \le S \le P\)) is the number of available satellite channels and \(P\) is the total number of outposts.
- Each of the next \(P\) lines contains two floating point numbers representing the \(x\) and \(y\) coordinates of an outpost.
It is guaranteed that all test cases are valid and the coordinates are given in a 2D Euclidean space.
outputFormat
For each test case, output a line containing the minimum required radio transceiver range \(D\). The answer should be printed rounded to exactly two digits after the decimal point.
sample
1
2 4
0 100
0 300
0 600
150 750
212.13