#P8074. [COCI 2009/2010 #7] SVEMIR
[COCI 2009/2010 #7] SVEMIR
Problem Description
The Space Empire wants to connect its planets by building tunnels.
Each planet is represented by a 3D coordinate . The cost to build a tunnel between two planets is .
Now you need to build tunnels so that all planets are connected directly or indirectly. Find the minimum total cost required to complete this task.
Input Format
The first line contains an integer .
The next lines each contain three integers , representing the coordinates of the -th planet.
It is guaranteed that no two planets have the same coordinates.
Output Format
Output the minimum total cost required.
2
1 5 10
7 8 2
3
3
-1 -1 -1
5 5 5
10 10 10
11
5
11 -15 -15
14 -5 -15
-1 -1 -5
10 -4 -1
19 -4 19
4
Hint
Constraints
- For of the data, , .
Hints and Notes
This problem is translated from COCI 2009-2010 CONTEST #7 Task 4 SVEMIR.
The score for this problem follows the original COCI settings, with a full score of .
Translated by ChatGPT 5