Stallion and mare
Limits: 2 sec., 256 MiB
This statement was translated automatically from Ukrainian.
A stallion and a mare are grazing in a huge pasture, which can be viewed as a standard plane. The stallion is at the point \((x_1, y_1)\), and the mare is at the point \((x_2, y_2)\). None of the horses’ coordinates are equal to zero.
Stadar (the horse herder) has installed two infinite fences along the coordinate axes. Determine whether the stallion and the mare can meet without crossing a fence.
Input
The first line contains two integers \(x_1\) and \(y_1\) — the coordinates of the stallion.
The second line in the same format contains \(x_2\) and \(y_2\) — the coordinates of the mare.
Output
Output Yes if the stallion and the mare can meet, or
No if they cannot.
Constraints
\(0 < |x_i|, |y_i| \le 10^9\).
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 47 4 7 74 | Yes |
| Input (stdin) | Output (stdout) |
|---|---|
| -1 -1 1 1 | No |
| Input (stdin) | Output (stdout) |
|---|---|
| 477774 -4 77774474 -7 | Yes |
Notes
In the first example, the stallion and the mare are not separated by a fence.
In the second example, the stallion and the mare are separated by fences.
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 |
|---|