CodePSU 2018 - Beginner


2018-03-18 19:00 CET

CodePSU 2018 - Beginner


2018-03-18 23:00 CET
The end is near!
Contest is over.
Not yet started.
Contest is starting in -612 days 7:58:10

Time elapsed


Time remaining


Problem D
Alien Space Travel

Giorgio, an alien conspiracy theorist, is looking up at the night sky. He spots two stars and tries to imagine an infinitely straight line that travels across space through where the two stars are. His theorist mind starts to think.“What if this line is actually an infinitely long, intergalactic highway that aliens use to travel through the universe? And what if aliens even just call it like ‘Highway-1’ like humans do?” Giorgio then starts picking out other pairs of stars in the night sky and imagining other infinite intergalactic highways that go through them. Then, Giorgio thinks to himself, “If all the stars - and intergalactic highways consequently - were to lie on the same 2-dimensional plane in space, would Highway-1 actually have any intersections with these other highways?”


The first and second lines contain two space-separated integers denoting the $x$ and $y$ values for the two initial stars on the imaginary 2-dimensional plane, marking Highway-1.
The third line contains a single integer, H, the number of new highways, where ($1 \leq H \leq 10$).
Each highway is constructed by two subsequent lines, each being new two space-separated $x$ and $y$ values, the two new stars, which mark the new highway.
Let’s imagine Giorgio will only choose stars whose coordinates lie within ($-10^{4} \leq x, y \leq 10^{4}$). You may assume that, for any given highway, two points will be distinct.


For each test case, print out NO if the new highway would not have an intersection with Highway-1. Print out YES if the new highway would. If a new proposed highway is collinear with Highway-1, assume that the aliens decide not to create a new highway and print NO.

Sample Input 1 Sample Output 1
0 4
0 -4
1 3
1 -3
4 2
-4 -2
Sample Input 2 Sample Output 2
4 7
6 7
-90 -12
46 -12