#K95957. Minimize Maximum Latency
Minimize Maximum Latency
Minimize Maximum Latency
You are given (T) test cases. For each test case, you are provided with an integer (n) representing the number of remote data centers, followed by (n) integers representing the latencies from the main data center to each remote data center. Your task is to calculate the minimum possible value of the maximum latency after placing one load balancer between the main data center and each remote data center. Mathematically, for a list of latencies (L = [L_1, L_2, \dots, L_n]), the answer is given by:
[ \text{Answer} = \frac{\max{L_1, L_2, \dots, L_n}}{2} ]
Print the result for each test case on a new line as a floating-point number.
inputFormat
Input is read from standard input (stdin). The first line contains an integer (T), representing the number of test cases. Each test case consists of a single line starting with an integer (n) (the number of remote data centers) followed by (n) space-separated integers denoting the latencies.
outputFormat
For each test case, output the minimum possible value of the maximum latency as a floating-point number on a new line, computed as (\frac{\max{L}}{2}).## sample
3
3 10 20 30
2 100 200
4 1 2 3 4
15.0
100.0
2.0
</p>