#abc315f. F - Shortcuts
F - Shortcuts
Score : points
问题描述
在坐标平面上有一场按顺序经过检查点 的比赛。 检查点 的坐标为 ,所有检查点的坐标均不相同。
除了检查点 和 之外,其它检查点可以跳过。 但是,设跳过的检查点数量为 ,将会受到以下惩罚:
- 若 ,则惩罚为 ;
- 若 ,则惩罚为 。
令 为从检查点 到检查点 的总行驶距离(欧几里得距离)加上相应的惩罚。
请找出可达到的最小值 。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
There is a race through checkpoints in this order on a coordinate plane.
The coordinates of checkpoint are , and all checkpoints have different coordinates.
Checkpoints other than checkpoints and can be skipped.
However, let be the number of checkpoints skipped, and the following penalty will be imposed:
- if , and
- if .
Let be the total distance traveled (Euclidean distance) from checkpoint to checkpoint plus the penalty.
Find the minimum achievable value as .
Constraints
- All input values are integers.
- if .
Input
The input is given from Standard Input in the following format:
Output
Print the answer. Your output is considered correct if the absolute or relative error from the true value is at most .
Sample Input 1
6
0 0
1 1
2 0
0 1
1 0
2 1
Sample Output 1
5.82842712474619009753
Consider passing through checkpoints and skip checkpoints .
- Move from checkpoint to . The distance between them is .
- Move from checkpoint to . The distance between them is .
- Move from checkpoint to . The distance between them is .
- Two checkpoints are skipped, so the penalty of is imposed.
In this way, you can achieve .
You cannot make smaller than this value.
Sample Input 2
10
1 8
3 7
9 4
4 9
6 1
7 5
0 0
1 3
6 8
6 4
Sample Output 2
24.63441361516795872523
Sample Input 3
10
34 24
47 60
30 31
12 97
87 93
64 46
82 50
14 7
17 24
3 78
Sample Output 3
110.61238353245736230207
update @ 2024/3/10 09:01:12