#P9630. Kotori's Skiing
Kotori's Skiing
Kotori's Skiing
Kotori loves skiing. The skiing field is an infinite strip on the 2D plane defined by \( -m \le x \le m \). Kotori starts at \((0, -10^{10^{10^{10^{10}}}})\) (you may regard this as a starting point at \(y=-\infty\)) and moves upward with fixed vertical speed \(v_y\). She can change her horizontal speed arbitrarily at any moment, but it must always lie in \([-v_x, v_x]\), where \(v_x\) is a parameter you can choose.
On the field, there are \(n\) obstacles. Each obstacle is given by a horizontal segment \([a, b]\) located at a fixed \(y\)-coordinate. When skiing, Kotori cannot cross any obstacle; that is, her path must never touch any point on an obstacle. Also, she must remain within the field boundaries (i.e. \(x\) must always satisfy \(-m \le x \le m\)).
Because Kotori starts at \(y=-\infty\), she has arbitrarily much vertical time before encountering the first obstacle, and hence she can begin her journey from any \(x\)-position in \([-m, m]\). However, between successive obstacles the available vertical distance is finite. Thus, given the constant vertical speed \(v_y\), the maximum horizontal distance Kotori can cover between two obstacles separated by a vertical gap \(\Delta y\) is \(\frac{v_x}{v_y} \cdot \Delta y\).
Your task is to determine the minimum value \(v_x^*\) such that if \(v_x > v_x^*\), Kotori can safely ski all the way upward avoiding all the obstacles. If there are no obstacles, output 0. Note that all formulas must be written in \(\LaTeX\) format.
inputFormat
The first line of input contains three numbers: an integer \(n\) (the number of obstacles), a number \(m\) (half the width of the skiing field) and a number \(v_y\) (the constant vertical speed). Each of the next \(n\) lines contains three numbers \(a\), \(b\) and \(y\), meaning that there is an obstacle occupying the horizontal segment \([a, b]\) at vertical coordinate \(y\). It is guaranteed that \(-m \le a < b \le m\).
outputFormat
Output a single number: the minimum value of \(v_x^*\) (printed with at least 6 decimal places) such that if \(v_x > v_x^*\), Kotori can ski upward safely without hitting any obstacle.
sample
0 10 1
0.000000