SP695 UFAST - Unite Fast
Description
The Agents need to unite. They are on a road and each of them possess a special device which can both send and receive signals, in both directions upto a maximal distance of D units. Apart from this small limitation, the devices work very efficiently so that the time taken for interdevice communication is practically zero. Now that the agents are at different points on the road, for them to be able to communicate with each other at will, every agent should be connected to every other agent through one or more intermediate devices. For example: agent A may communicate to agent C via agent B’s device, when A and C are not close enough. This happens when **dist**(A,C)>D, but **dist**(A,B)
Input Format
T – number of test cases. For each test case :
N D – where N is the number of agents, D is the maximal communication distance
The i-th line, of the N-lines that follow gives the position of the i-th agent on the road currently.
Output Format
For each test case, output two integers;
1st – minimal time taken to unite if they move independently
2nd - minimal time taken to unite if they move sequentially
**Constraints:**
T