| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 10 초 | 1024 MB | 1 | 1 | 1 | 100.000% |
Cross-country running is a sport in which contestants run a race on an open-air course over natural terrain. To record contestants' progress, the organisers set up RFID checkpoints that each span a line across part of the course.
A contestant has finished the race once they go through all of the checkpoints in order from 1ドル$ to $n$. Crossing a checkpoint out of order conveys no advantage or penalty to a runner, as they simply have to cross it again later at the right time. Thus, for example, a runner may choose to cross a checkpoint once and then immediately cross it again in another direction if it leads to a quicker finish.
Figure C.1: Optimal running route for the course given in sample input 3.
Your objective is to find the shortest distance one has to run to finish the race, so that we can use this as the official distance of the course.
All of the checkpoints have non-zero length; however, they may overlap either with each other or with the start and finish points.
Output the shortest distance you can run to go visit all of the checkpoints in the right order, regardless of whether you touch some of the checkpoints multiple times or in the wrong order along the way.
The output must be accurate to an absolute or relative error of at most 10ドル^{-6}$.
2 0 1 10 0 10 2 20 2 20 0 30 1
30
4 5 5 10 1 8 -1 12 3 13 0 18 3 17 0 20 1 22 -1 25 5
22.80624847
3 0 0 3 -1 2 1 8 0 8 1 5 -1 5 1 0 2
16.144380531
ICPC > Regionals > Europe > Northwestern European Regional Contest > The UK & Ireland Programming Contest > UKIEPC 2024 C번