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

16405번 - Treehouses 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB106695258.427%

문제

In a rainforest there are n treehouses high in the forest canopy on different trees (numbered from 1 to n). The i-th tree’s location is at (xi, yi). The first e of them in the list are close enough to neighboring open land around the rainforest so that transportation between all of them is easy by foot. Some treehouses may already be connected by direct straight cables through the air that can allow transport between them. Residents want easy transportation between all the treehouses and the open land, by some combination of walking (between those near the open land), and using one or more cables between treehouses. This may require the addition of more cables. Since the cables are expensive, they would like to add the smallest possible length of cable.

The height of a cable up two trees can be set so cables can criss-cross other cables, and not allow any snags or crashes. It is not safe to try to switch between two criss-crossed cables in mid-air!

입력

The input will start with the three integers n (1 ≤ n ≤ 1 000), e (1 ≤ e ≤ n), and p (0 ≤ p ≤ 1 000), where p is the number of cables in place already.

Next come n lines, each with two real numbers x and y (|x|, |y| ≤ 10 000) giving the location of a treehouse. The i-th coordinate pair is for the treehouse with ID i. All coordinate pairs are unique. Real numbers are stated as integers or include one digit after a decimal point.

Next come p lines, each with two integers a, b, where 1 ≤ a < b ≤ n, giving the two treehouse ids of an existing cable between their trees. No ID pair will be repeated.

출력

The output is the minimum total length of new cable that achieves the connection goal, expressed with absolute or relative error less than 0.001.

제한

예제 입력 1

3 1 0
0.0 0.0
2.0 0.0
1.0 2.0

예제 출력 1

4.236

예제 입력 2

3 1 1
0.0 0.0
0.5 2.0
2.5 2.0
1 2

예제 출력 2

2.000

예제 입력 3

3 2 0
0.0 0.0
2.0 0.0
1.0 2.0

예제 출력 3

2.236

힌트

출처

ICPC > Regionals > North America > Mid-Central Regional > 2018 Mid-Central Regional Programming Contest A번

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

출처

대학교 대회

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

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