Universal Cup Judging System

Universal Cup

حد الوقت: 1 s حد الذاكرة: 512 MB مجموع النقاط: 100 قابلة للهجوم ✓
الإحصائيات

あなたは道路を渡ろうとしていますが、その道路を電動自転車が高速で走っています。

直交座標平面上で、幅 $w$ の道路が $x$ 方向に無限に延びており、帯状の領域 $0 \le y \le w$ を占めています。あなたは固定された点 $(0,0)$ から出発し、道路上の電動自転車を避けながら、上側の境界 $y=w$ 上のいずれかの点に到達したいと考えています。

電動自転車の車体は、$x$ 軸に平行な線分で表されます。時刻 $t=0$ における両端点は $(x_1,y_c)$ と $(x_2,y_c)$ であり、$x_1<x_2$ です。電動自転車は一定の水平方向の速度 $u$ で移動するため、時刻 $t$ における両端点は $(x_1+ut,y_c)$ と $(x_2+ut,y_c)$ です。

あなたはどの方向にも移動でき、待機することもできますが、速さが $v$ を超えてはいけません。言い換えると、任意の 2 つの時刻 $0 \le t_1 \le t_2$ に対して、それらの時刻におけるあなたの位置の間のユークリッド距離は $v(t_2-t_1)$ 以下でなければなりません。どの時刻においても、端点を除く電動自転車の線分上にいてはいけません。どちらの端点に触れることも許されます。

あなたは時刻 $t=0$ に $(0,0)$ から出発します。$y=w$ 上のいずれかの点に安全に到達するために必要な最小時間を求めてください。答えが必ず存在することを示せます。

入力

最初の行には、テストケースの数を表す整数 $T$ ($1 \le T \le 2000$) が与えられます。

各テストケースは、6 個の整数 $w,x_1,x_2,y_c,u,v$ ($2 \le w \le 4\times 10^4$、$-4\times 10^4 \le x_1<x_2 \le 4\times 10^4$、$1 \le y_c \le w-1$、$-4\times 10^4 \le u \le 4\times 10^4$、$1 \le v \le 4\times 10^4$) を含む 1 行からなります。ここで、$w$ は道路の幅、$(x_1,y_c)$ と $(x_2,y_c)$ は時刻 $t=0$ における電動自転車の両端点、$u$ は電動自転車の水平方向の速度、$v$ はあなたの最大の速さです。

出力

各テストケースについて、$y=w$ に安全に到達するために必要な最小時間を表す実数を、独立した行に 1 個出力してください。

答えの絶対誤差または相対誤差が $10^{-6}$ 以下であれば、正解とみなされます。より正確には、出力した各値 $a$ と、それに対応する基準値 $b$ に対して、$\frac{|a-b|}{\max(1,|b|)} \le 10^{-6}$ を満たす必要があります。

入出力例

入力 1

3
10 100 110 5 3 1
10 -2 2 1 1 2
10 -2 2 1 -1 1

出力 1

10.000000000
5.286299648
10.250000000

注記

下の図は、入出力例の 2 番目のテストケースの初期状態 ($t=0$) を示しています。オレンジ色の線分は電動自転車を表し、青い点 $S=(0,0)$ はあなたの出発点です。矢印は電動自転車の移動方向を示しており、$u=1$ です。

problem_20717_d1ad77d2bf3188e5ecd6559af07d96b6.png

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.