QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 512 MB Total points: 100

#4886. 最高の太陽

Statistics

Ivanは絵を描くのが好きです。彼は太陽を描くことにしました。 そのために、彼は平面上の整数座標を持つ $n$ 個の点を用意しました。Ivanは、最高の太陽を作るために、いくつかの点のペアを線分で結びます。

  • Ivanは、ちょうど $n$ 本の線分で点のペアを結びます。
  • すべての線分は(端点を除いて)交差してはいけません。
  • サイクルはちょうど1つ存在しなければなりません。このサイクルは凸多角形でなければなりません。
  • 多角形の頂点ではない各点は、多角形の外側に位置し、多角形の頂点のいずれかと結ばれていなければなりません。
  • すべての点がサイクル上の頂点となることも可能です。

Ivanは明るく美しい太陽を描きたいと考えています。そこで彼は太陽のスコアを次のように定義しました。

  • $S$ を多角形の面積とします。
  • $P$ を描かれたすべての線分の長さの合計とします。
  • 値 $\frac{S}{P}$ を太陽のスコアとします。

太陽のスコアの最大値はいくつでしょうか。

入力

1行目には、テストケースの数 $t$ ($1 \le t \le 10^4$) が与えられます。続いて各テストケースの説明が続きます。

各テストケースの1行目には、点の数 $n$ ($3 \le n \le 300$) が与えられます。 続く $n$ 行の各行には、2つの整数 $x_i, y_i$ ($|x_i|, |y_i| \le 10^6$) が与えられます。すべての点は異なります。どの3点も同一直線上にありません。

すべてのテストケースにおける $n^2$ の合計は $90\,000$ を超えないことが保証されています。

出力

各テストケースについて、描くことができる太陽のスコアの最大値を実数で出力してください。 絶対誤差または相対誤差は $10^{-6}$ を超えてはなりません。

入出力例

入力 1

4
3
-1 -1
1 -1
0 1
4
0 0
10 0
0 10
8 1
5
2 0
-2 0
1 1
-1 1
0 3
8
4 4
-4 4
4 -4
-4 -4
5 6
-6 5
-5 -6
6 -5

出力 1

0.3090169943749474
1.2368614277111258
0.2711375415034555
1.5631002094915825

注記

4番目のテストケースにおける最大スコアの太陽の図です。

この太陽について、$S = 64, P = 32 + 4\sqrt{5}$ であるため、そのスコアは $\frac{64}{32 + 4\sqrt{5}}$ となります。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.