Burdock Antivirus
Limits: 2 sec., 256 MiB
This statement was translated automatically from Ukrainian.
Tests of the burdock antivirus are in full swing. Currently, immunologist scientists are conducting laboratory tests of its effectiveness. The experiment looks as follows:
The experiment takes place on an infinite two-dimensional plane.
At time moment \(t = 0\), two burdock viruses are placed on the plane at points with coordinates (\(x_1\), \(y_1\)) and (\(x_2\), \(y_2\)), and the burdock antivirus is placed at the cell with coordinates (\(x\), \(y\)).
After the start of the experiment, both viruses begin to move in the directions (\(dx_1\), \(dy_1\)) and (\(dx_2\), \(dy_2\)) respectively. This means that the \(i\)-th virus at time moment \(t\) will be located at the point (\(x_i + t \cdot dx_i\), \(y_i + t \cdot dy_i\)).
The antivirus can move across the plane with an arbitrary speed not exceeding \(v\). It can move in any direction and change it arbitrarily. Also, if necessary, it can stay in place.
The task of the antivirus is to destroy both viruses as quickly as possible. Destroying a virus means being at the same point with it at some moment in time. After that, the virus ceases to exist. The antivirus can destroy the viruses in any order.
Your task is to calculate the minimum time in which the antivirus will destroy both viruses.
Input
The first line gives information about the first virus: four integers \(x_1\), \(y_1\), \(dx_1\), \(dy_1\) — its coordinates and direction of movement, respectively.
The second line gives four integers \(x_2\), \(y_2\), \(dx_2\), \(dy_2\) — information about the second virus in the same format.
The third line gives three integers \(x\), \(y\), \(v\) — the coordinates and movement speed of the antivirus.
The speed of the antivirus is strictly greater than the speed of each virus, so the antivirus can always destroy both viruses.
Output
In a single line, output one number — the minimum time in which the antivirus can destroy both viruses.
The answer will be accepted if the absolute or relative error does not exceed \(10^{-7}\).
Constraints
\(-10^6 \le x_1, y_1, x_2, y_2, x, y, dx_1, dy_1, dx_2, dy_2 \le 10^6\),
\(1 \le v \le 10^6\).
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| -4 0 1 0 4 0 -1 0 -1 0 2 | 3 |
| Input (stdin) | Output (stdout) |
|---|---|
| 6 -5 2 -3 -6 -5 1 1 -3 0 10 | 2.27733751288 |
Submit a solution
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|