410541: GYM104048 B Foo Bar

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Foo Bartime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

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?

Input

The 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$$$.

Output

Output "Yes" if the bars will collide, or "No" if they won't.

ExamplesInput
1 1 2 2
0 0 1 0
Output
Yes
Input
2 2 1 1
0 0 1 0
Output
No
Note

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.

加入题单

算法标签: