LCC '21 Contest 4 J4 - Stacy the Space Rover

View as PDF

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Stacy the space rover is roaming around in space. The planet she is on can be denoted by a cartesian coordinate system. She is being remote controlled by her operator, sitting in the space shuttle located at . The operator remotely sends a series of commands to Stacy. Each command consists of values, and , indicating the and distance she must move, respectively.

At the end of the set of commands, Stacy must make her way back to the space shuttle at . To be the most efficient, Stacy's operator has coded her to move in a straight line directly from her location to the space shuttle.

Unbeknown to the space shuttle operator, rocks landed on the planet right as Stacy begins to make her way back. Since Stacy's operator did not prepare for these rocks, they did not prepare her to maneuver around them. If Stacy runs into a rock, she will break!

Given the commands Stacy must make, and the rocks landed on the planet, can you output if Stacy will make it back or not?

Input Specification

The first line of input will contain two space-separated integers, and , the number of commands Stacy must make, and the number of rocks that landed on the planet just as Stacy plans to head back, respectively.

The next lines will contain two space-separated integers, and , the distance she must move, and the distance she must move, respectively.

The last lines will contain two space-separated integers, and , the and coordinates of a rock, respectively.

It is guarateed that no rock will ever land on top of Stacy's position at the end of the series of commands or on the space shuttle. It is possible two rocks will land on top of each other.

Output Specification

Output a single string, yes if Stacy can make it back to the space shuttle, and no if she cannot.

Sample Input

3 1
1 1
4 1
-26 1
-7 1

Sample Output

no

Explanation for Sample

At the end of the series of commands, Stacy will end up at position . A single rock is located at position , which will be on her trajectory back to the space shuttle. Thus, Stacy will be unable to return to the space shuttle.