410541: GYM104048 B Foo Bar
Description
You've recently acquired two bars made of Foo, and want to put them on your wall for display.
You've already decided where the endpoints of each bar should be, and in particular which endpoint the bar is mounted to.
The problem is, Foo is a very light metal, and will spin around in the AC current uncontrollably! Specifically, a bar will rotate as a straight line about its endpoint.
Ideally, you'd like the bars to never have any possibility of hitting each other, as they could be damaged by the collision. Can you check if the bars will ever collide?
InputThe first line contains four integers, $$$x_1, y_1, x_2, y_2$$$, representing the endpoints $$$(x_1, y_1)$$$ and $$$(x_2, y_2)$$$ of the first bar. $$$(x_1, y_1)$$$ is the mounted endpoint of the first bar.
Similarly, the second line contains four integers $$$x_3, y_3, x_4, y_4$$$, representing the endpoints $$$(x_3, y_3)$$$ and $$$(x_4, y_4)$$$ of the second bar. $$$(x_3, y_3)$$$ is the mounted endpoint of the first bar.
All coordinates have absolute value less than or equal to $$$10^9$$$.
OutputOutput "Yes" if the bars will collide, or "No" if they won't.
ExamplesInput1 1 2 2 0 0 1 0Output
YesInput
2 2 1 1 0 0 1 0Output
NoNote
The first test case looks as follows:
The solid red line represents the initial position of the first bar. The solid green line represents the initial position of the second bar.
The highlighted points are the bars respective mounted endpoints, and the dotted lines show how the bars could be rotated to cause a collision.