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

6725번 - Connecting islands 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB63111024.390%

문제

In order to win the last election the politicians promised the inhabitants of the Skofoten islands that they would connect all the islands by building bridges between them so that any island is reachable from any other island. After the election it occurred to them that this could get very costly, so in order to keep the cost down they have asked you to write a program that will determine the minimum cost needed to fulfill their promise. You can assume that the cost of a bridge is proportional to its length, thus we wish to calculate the minimum total length of the bridges needed to connect all the islands. Each island is represented by a polygon and to make things easier you can assume that bridges only run between corners of two polygons. Note that a bridge can only run over water, however, bridges can cross each other. Also note that the shape of islands can be non-convex.

입력

The first line of input contains the number of test cases. A test case consists of one line holding the number of islands (2 ≤ N ≤ 15), followed by N lines that describe the islands. An island is a polygon, which is described as a number (1 ≤ P ≤ 25) that gives the number of points followed by P pairs of coordinates. Each coordinate is an integer in the range [-1000. . . 1000]. The points are listed in order such that by connecting consecutive points, and the last point to the first, the perimeter of the island is given. It is guaranteed that islands do not touch or intersect.

출력

For each test case output two lines reporting the minimal interconnect as follows:

The minimal interconnect consists of N bridges with a total length of L.

where N is the number of bridges, and L is the total length, which should be printed as a floating point number with an accuracy of three digits.

제한

예제 입력 1

1
3
4 0 0 0 1 1 1 1 0
4 2 0 2 1 3 1 3 0
3 4 0 5 0 5 1

예제 출력 1

The minimal interconnect consists of 2 bridges
with a total length of 2.000.

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > Nordic Collegiate Programming Contest > NCPC 2001 E번

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

출처

대학교 대회

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

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