C - Catch the Last Train! Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MiB

配点 : 300

問題文

高橋君は、終電に乗るために駅へ向かっています。

高橋君は数直線上の座標 0 にいて、駅は座標 G にあります( G > 0 )。一方、終電は現在座標 M にいて、高橋君のいる方向へ向かって走ってきており、駅に到着した後は発車して去っていきます。

高橋君は通常、毎秒 1 の速度で移動できますが、「全力ダッシュ」をすることで、その秒は速度が D 倍になります。ただし、体力の関係で全力ダッシュは合計で K 秒分しかできません。

終電は毎秒 V の速度で駅に向かって移動しています。終電が駅に到着してから発車するまでの停車時間は一瞬であるため、高橋君が駅に到着するより先に終電が駅を通過してしまうと、高橋君は終電に乗れません。

高橋君が全力ダッシュを最適に使ったとき、終電に間に合うかどうかを判定してください。

なお、高橋君と終電は同時に移動を開始し、高橋君が駅に到達した瞬間以前に終電も駅に到達していれば、高橋君は終電に乗ることができます(同時に到達した場合も乗れます)。

制約

  • 1 \leq G \leq 10^9
  • G \leq M \leq 10^{15}
  • 2 \leq D \leq 10^9
  • 0 \leq K \leq 10^9
  • 1 \leq V \leq 10^9
  • 入力はすべて整数

入力

G M D K V
  • 1 行目には、駅の座標 G 、終電の初期座標 M 、全力ダッシュ時の速度倍率 D 、全力ダッシュを使える秒数 K 、終電の速度 V が、スペース区切りで与えられる。

出力

高橋君が終電に間に合う場合は Yes を、間に合わない場合は No を出力せよ。


入力例 1

10 30 3 2 1

出力例 1

Yes

入力例 2

100 120 2 3 10

出力例 2

No

入力例 3

1000000000 1000000000000000 1000000000 1 1

出力例 3

Yes

Score : 300 pts

Problem Statement

Takahashi is heading to the station to catch the last train.

Takahashi is at coordinate 0 on a number line, and the station is at coordinate G (G > 0). Meanwhile, the last train is currently at coordinate M and is heading toward Takahashi's direction, toward the station. After arriving at the station, the train will depart and leave.

Normally, Takahashi can move at a speed of 1 per second, but by performing a "full sprint," his speed becomes D times faster for that second. However, due to stamina limitations, he can only sprint for a total of K seconds.

The last train is moving toward the station at a speed of V per second. Since the stopping time between the train's arrival at the station and its departure is instantaneous, if the last train passes through the station before Takahashi arrives, he cannot board the train.

Determine whether Takahashi can catch the last train if he uses his full sprints optimally.

Note that Takahashi and the last train start moving simultaneously. Takahashi can board the last train if the train has also arrived at the station by the moment Takahashi reaches the station (including the case where they arrive at the same time).

Constraints

  • 1 \leq G \leq 10^9
  • G \leq M \leq 10^{15}
  • 2 \leq D \leq 10^9
  • 0 \leq K \leq 10^9
  • 1 \leq V \leq 10^9
  • All inputs are integers

Input

G M D K V
  • The first line contains the station's coordinate G, the last train's initial coordinate M, the speed multiplier during full sprint D, the number of seconds full sprint can be used K, and the last train's speed V, separated by spaces.

Output

If Takahashi can catch the last train, print Yes; otherwise, print No.


Sample Input 1

10 30 3 2 1

Sample Output 1

Yes

Sample Input 2

100 120 2 3 10

Sample Output 2

No

Sample Input 3

1000000000 1000000000000000 1000000000 1 1

Sample Output 3

Yes