i stands at the point shops[i] = [xᵢ, yᵢ] on the plane. The depot can go anywhere on the plane; its coordinates need not be integers.
Find the smallest possible sum of the ordinary (Euclidean) distances from the depot to all the shops: √((x - xᵢ)² + (y - yᵢ)²), added up over every i.
An answer within 10⁻⁵ of the exact value is accepted. Several shops may stand at the same point.shops=[[0, 0], [6, 0], [0, 6], [6, 6]] → 16.97056274847714
A depot at the centre of the square, (3, 3), is √18 ≈ 4.24264 from each shop, ≈ 16.97056 in total.
shops=[[2, 5], [2, 5], [9, 5]] → 7.000000643961637
The best spot is right at (2, 5), where two of the shops are: the third one is then 7 away.
shops=[[40, 40]] → 0.0
shops=[[0, 0], [6, 0], [0, 6], [6, 6]]
16.97056274847714
Run checks the first 3 tests in your browser. Submit checks all 105 tests on the server, hidden ones included.