Logo
(追記) (追記ここまで)

32562번 - Cross Country 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
10 초 1024 MB111100.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.

입력

  • One line containing the number of checkpoints, $n$ (1ドル \le n \le 16$).
  • One line containing the start coordinate of the race, $x_s$ and $y_s$ ($-10^6 \le x, y \le 10^6$).
  • $n$ further lines, the $i$th of which contains the two integer coordinate of the $i$th checkpoint's endpoints, ${x_a}_i y_a x_b y_b$ ($-10^6 \le x,y \le 10^6$).
  • One line containing the end coordinate of the race, $x_t$ and $y_t$ ($-10^6 \le x, y \le 10^6$).

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}$.

제한

예제 입력 1

2
0 1
10 0 10 2
20 2 20 0
30 1

예제 출력 1

30

예제 입력 2

4
5 5
10 1 8 -1
12 3 13 0
18 3 17 0
20 1 22 -1
25 5

예제 출력 2

22.80624847

예제 입력 3

3
0 0
3 -1 2 1
8 0 8 1
5 -1 5 1
0 2

예제 출력 3

16.144380531

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > The UK & Ireland Programming Contest > UKIEPC 2024 C번

  • 문제를 만든 사람: Robin Lee
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /