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.

Operations Research : Applications and Algorithms
4th Edition
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Wayne L. Winston
Chapter11: Nonlinear Programming
Section11.6: Unconstrained Maximization And Minimization With Several Variables
Problem 9P
icon
Related questions
Question

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.

 

 

Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Probability Problems
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole