Five Steiner

시간 제한5초메모리 제한2048 MB

요약
정수 좌표를 가진 다섯 점이 주어질 때, 임의의 추가 점을 허용하는 슈타이너 최소 트리의 총 변 길이를 구한다.
난이도

어려움10점 중 8점

유형
기하, 완전 탐색, 그리디, 수학
정답자
아직 제출이 없습니다

문제

After reading the paper Steiner minimal trees on sets of four points, one has decided to make things a bit harder. Why not five points instead?

You are given 55 points with integer coordinates on the plane. The distance between two points is defined by the Euclidean distance.

Please find the sum of distances of the minimum weight†^\dagger steiner tree‡^\ddagger of the given points.

†^\dagger The weight of a tree is defined by the sum of distances between all pairs of points connected by edges.

‡^\ddagger A steiner tree is defined as a tree spanning the given points, possibly containing some arbitrary number of points added to the point set. The added points need not have integer coordinates.

입력

Each test contains multiple test cases. The first line contains the number of test cases tt (1≤t≤101 \le t \le 10). The description of the test cases follows.

Each test case consists of five lines, containing the following input.

  1. Two integers x_ax\_a and y_ay\_a, the coordinates of the first point AA. (−105≤x_a,y_a≤105-10^5 \le x\_a,y\_a \le 10^5)
  2. Two integers x_bx\_b and y_by\_b, the coordinates of the second point BB. (−105≤x_b,y_b≤105-10^5 \le x\_b,y\_b \le 10^5)
  3. Two integers x_cx\_c and y_cy\_c, the coordinates of the third point CC. (−105≤x_c,y_c≤105-10^5 \le x\_c,y\_c \le 10^5)
  4. Two integers x_dx\_d and y_dy\_d, the coordinates of the fourth point DD. (−105≤x_d,y_d≤105-10^5 \le x\_d,y\_d \le 10^5)
  5. Two integers x_ex\_e and y_ey\_e, the coordinates of the fifth point EE. (−105≤x_e,y_e≤105-10^5 \le x\_e,y\_e \le 10^5)

출력

For each test case, print the sum of distances of the minimum steiner tree of the given points on one line.

Your output will be accepted if the absolute or relative error does not exceed 10−510^{-5}.

예제1

  1. 예제 1

    입력
    2
    -2 -1
    -1 1
    0 -1
    1 1
    2 -1
    0 2
    3 1
    -3 1
    -1 -2
    1 -2
    
    예상 출력
    7.464101
    11.332503