100 atcoder#ABC180E. [ABC180E] Traveling Salesman among Aerial Cities
[ABC180E] Traveling Salesman among Aerial Cities
Score : points
Problem Statement
In a three-dimensional space, there are cities: City through City . City is at point .
The cost it takes to travel from a city at point to a city at point is .
Find the minimum total cost it takes to start at City , visit all other cities at least once, and return to City .
Constraints
- No two cities are at the same point.
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the minimum total cost it takes to start at City , visit all other cities at least once, and return to City .
2
0 0 0
1 2 3
9
The cost it takes to travel from City to City is .
The cost it takes to travel from City to City is .
Thus, the total cost will be .
3
0 0 0
1 1 1
-1 -1 -1
10
For example, we can visit the cities in the order , , , , to make the total cost . Note that we can come back to City on the way.
17
14142 13562 373095
-17320 508075 68877
223606 -79774 9979
-24494 -89742 783178
26457 513110 -64591
-282842 7124 -74619
31622 -77660 -168379
-33166 -24790 -3554
346410 16151 37755
-36055 51275 463989
37416 -573867 73941
-3872 -983346 207417
412310 56256 -17661
-42426 40687 -119285
43588 -989435 -40674
-447213 -59549 -99579
45825 7569 45584
6519344