QOJ.ac

QOJ

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

#985. 飛行機内のアトラクション

Statistics

あなたはデカルト平面上を旅しています。$(0, 0)$ から $(X, 0)$ まで一定の速度で移動しながら、アトラクションを観光します。アトラクションは平面上の長方形としてモデル化されており、底面は $(x_i, y_i)$、幅は $w_i$、高さは $h_i$ です。残念ながら、アトラクション同士は重なることがあります。

あなたからアトラクションまでの距離は、あなたからそのアトラクションの最も近い点までのユークリッド距離とします。あるアトラクションまでの距離がすべてのアトラクションの中で最小であるとき、そのアトラクションを「スターアトラクション」と呼びます。最小距離となるアトラクションが複数ある場合は、インデックスが小さい方がスターアトラクションとなります(評価が高いためです)。

各アトラクションがスターアトラクションである時間の割合をパーセンテージで求めてください。

入力

1行目には2つの整数 $N$ と $X$ が含まれます ($1 \le N \le 200\,000$, $1 \le X \le 1\,000\,000$)。

続く $N$ 行の各行には、4つの整数 $x_i, y_i, w_i, h_i$ が含まれます ($1 \le x_i, y_i \le 1\,000\,000$, $0 \le w_i, h_i \le 1\,000\,000$)。

出力

$N$ 行出力してください。$i$ 行目には、$i$ 番目のアトラクションがスターアトラクションである時間の割合を出力してください。

あなたの回答は、絶対誤差または相対誤差が $10^{-8}$ 以下であれば正解とみなされます。

入出力例

入力 1

2 10
1 2 5 1
2 1 1 5

出力 1

52.679491924
47.320508076

入力 2

4 7
1 3 0 0
3 4 0 0
5 5 0 0
3 4 0 0

出力 2

53.571428571
35.714285714
10.714285714
0.000000000

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.