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

31180번 - Paimon Polygon 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB53360.000%

문제

Paimon just puts $(n+1)$ distinct points on the plane, one of which is a special point $O=(0,0),ドル and denote the group of remaining points as $\mathbb{S}$.

We call a point set $\mathbb{U}$ strict convex set, if and only if $|\mathbb{U}| \ge 3$ and all the points from $\mathbb{U}$ lie exactly on the convex hull built from $\mathbb{U},ドル with no three points lying on the same line.

You should divide $\mathbb{S}$ into two sets $\mathbb{A}$ and $\mathbb{B}$ so that:

  • $\mathbb{A} \cap \mathbb{B}=\emptyset$.
  • $\mathbb{A} \cup \mathbb{B}=\mathbb{S}$.
  • $|\mathbb{A}| \ge 2, |\mathbb{B}| \ge 2$.
  • The point set $\mathbb{A} \cup \{O\}$ is a strict convex set, and denote its convex hull as $C_{\mathbb{A} \cup \{O\}}$.
  • The point set $\mathbb{B} \cup \{O\}$ is a strict convex set, and denote its convex hull as $C_{\mathbb{B} \cup \{O\}}$.
  • The outlines(edges) of $C_{\mathbb{A} \cup \{O\}}$ and $C_{\mathbb{B} \cup \{O\}}$ only intersect at point $O$. That is, only one point $O$ satisfies that it lies both on the outlines of $C_{\mathbb{A} \cup \{O\}}$ and $C_{\mathbb{B} \cup \{O\}}$.

Please help Paimon to maximize the sum of the perimeters of these two convex hulls. That is, find a valid division $\mathbb{A}$ and $\mathbb{B}$ which maximizes $(L(C_{\mathbb{A} \cup \{O\}}) + L(C_{\mathbb{B} \cup \{O\}})),ドル where $L(\text{polygon})$ means the perimeter of that polygon.

입력

There are multiple test cases. The first line of the input contains an integer $T$ indicating the number of test cases. For each test case:

The first line contains one integer $n$ (4ドル \le n \le 5 \times 10^5$) indicating the number of points in $\mathbb{S}$.

For the following $n$ lines, the $i$-th line contains two integers $x_i$ and $y_i$ ($-10^9 \le x_i, y_i \le 10^9,ドル $(x_i, y_i) \ne (0, 0)$) indicating the location of the $i$-th point in $\mathbb{S}$.

It's guaranteed that the points given in the same test case are pairwise different. However, there may be three points lying on the same line.

It's also guaranteed that the sum of $n$ of all test cases will not exceed 10ドル^6$.

출력

For each test case output one line containing a number indicating the maximum total perimeter. If there does not exist a valid division output "0" (without quotes) instead.

Your answer will be accepted if the relative or absolute error is less than 10ドル^{-6}$.

제한

예제 입력 1

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

예제 출력 1

17.2111025509
36.6326947621
0.0000000000

노트

A valid division (left) and an invalid division (right) of the first sample test case are shown below.

출처

Contest > Open Cup > 2021/2022 Season > Stage 9: Grand Prix of Nanjing F번

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

출처

대학교 대회

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

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