digger should mine precisely one jewel mine. Each excavator has a snare, which can be utilized to mine a jewel mine. On the off chance that an excavator at the point (a,b) utilizes his snare to mine a precious stone mine at the point (c,d), he will burn through (a−c)2+(b−d)2−−−−−−−−−−−−−−−√ energy to mine it (the distance between these focuses). The diggers can't move or help one another.
Correct answer will be upvoted else downvoted. Computer science.
Each digger should mine precisely one jewel mine. Each excavator has a snare, which can be utilized to mine a jewel mine. On the off chance that an excavator at the point (a,b) utilizes his snare to mine a precious stone mine at the point (c,d), he will burn through (a−c)2+(b−d)2−−−−−−−−−−−−−−−√ energy to mine it (the distance between these focuses). The diggers can't move or help one another.
The object of this game is to limit the amount of the energy that diggers spend. Would you be able to track down this base?
Input
The input comprises of different experiments. The main line contains a solitary integer t (1≤t≤10) — the number of experiments. The portrayal of the experiments follows.
The main line of each experiment contains a solitary integer n (1≤n≤105) — the number of diggers and mines.
Every one of the following 2n lines contains two space-isolated integers x (−108≤x≤108) and y (−108≤y≤108), which address the point (x,y) to depict an excavator's or a precious stone mine's position. Either x=0, which means there is a digger at the point (0,y), or y=0, which means there is a precious stone mine at the point (x,0). There can be different excavators or precious stone mines at a similar point.
It is ensured that no point is at the beginning. It is ensured that the number of focuses on the x-pivot is equivalent to n and the number of focuses on the y-hub is equivalent to n.
It's reliable that the amount of n for all experiments doesn't surpass 105.
Output
For each experiment, print a solitary genuine number — the negligible amount of energy that ought to be spent.
Your answer is considered right if its outright or relative mistake doesn't surpass 10−9.
Step by step
Solved in 4 steps with 1 images