Problem D
Forest for the Trees
You are playing hide-and-go-seek in a forest with Belle. The
forest has one tree at each of the positive integer lattice
points. That is, there is a tree at every point
You are standing at
For example, suppose that Belle is standing at
![\includegraphics[width=0.45\textwidth ]{trees.pdf}](/problems/forestforthetrees/file/statement/en/img-0001.png)
Given the rectangle and Belle’s location, can you see her?
Input
The first line of input contains two integer
The second line of input contains four integers
Output
If you can see Belle, display Yes.
Otherwise, display No and the coordinates of the closest tree that is blocking your view.
Sample Input 1 | Sample Output 1 |
---|---|
2 6 1 1 5 4 |
Yes |
Sample Input 2 | Sample Output 2 |
---|---|
2 6 3 5 5 7 |
No 1 3 |
Sample Input 3 | Sample Output 3 |
---|---|
830844890448 39710592053 821266 42860 402207107926 423171345006 |
No 402207964848 19223704203 |