#P14498. [NCPC 2025] Dune Dash
[NCPC 2025] Dune Dash
题目背景
:::align{center}

A runner during a 15-kilometer run through the Grand Bara Desert in Djibouti. Public domain photo by Joshua Bruns. :::
题目描述
You signed up for the , a running race across the desert. Everything went well — except that in the excitement, you forgot to start , the app that records how far you've run. All you have now are the official checkpoint locations, but not the order in which you passed through them.
Formally, the race consisted of checkpoints, each given by its coordinates in the Euclidean plane. The sequence in which they were visited is unknown to you, but the organizers designed the course to prevent anyone from straying off route. In particular, if is the correctly ordered list of the checkpoints along the race, then for every triple it holds that
$$\text{dist}(q_i, q_k) > \max(\text{dist}(q_i, q_j), \text{dist}(q_j, q_k) )$$where denotes the Euclidean distance between points and . Your task is to determine the total length of the race.
:::align{center}

Illustration of sample 2. The dashed line shows where the race went. :::
输入格式
The first line consists of the integer (). The following lines each contain two integers and (). These are the coordinates of each checkpoint.
The checkpoints are not necessarily in the order in which they were visited during the race. It is guaranteed that there is some ordering of the checkpoints such that they satisfy the distance requirements above.
The points given in the input are all distinct.
输出格式
Print one floating point number, the length of the race. Your answer will be correct if it has an absolute or relative error of at most .
3
1 0
0 0
1 1
2.0
10
-1 -7
-1 -11
0 -9
2 2
1 -2
2 -1
3 1
-1 -5
0 -3
-3 -11
17.186912597118443
京公网安备 11011102002149号