King's Keep
Time limit1sMemory limit1024 MB
Given k points, find the minimum over all points of the average Euclidean distance from that point to the other k-1 points.
- Level
Easy2 of 10
- Topics
- Brute force, Math
- Solved
- No attempts yet
Problem
King Carl's kingdom contains keeps (commonly called castles).
The coordinates of the keeps are known. King Carl is convinced that choosing a central keep as his residence could be convenient.
King Carl considers that the average cost to carry commands from his residence to his other keeps should be small.
Compute the minimal average Euclidean distance from his residence keep to the other keeps if King Carl chooses his residence optimally.
The Euclidean distance between two points is the length of a straight line segment between these points.
Input
The input consists of:
- One line with an integer (), the number of keeps.
- lines, each with two integers and (), the coordinates of the keeps.
All keeps are at distinct locations.
Output
Output the minimal possible average distance from the keep chosen as the king's residence to all other keeps.
Your answer should have an absolute or relative error of at most .