<PREV Problem:
NEXT>
Solved by 105 users: ...
UserDateAttemptTimeCMSC
bush22 apr 2006Ruby200.05341 
tomek15 apr 2006C++200.02454 
david_it2124 apr 2008Ruby100.09502 
tomek15 apr 2006C++100.01537 
mansur11503 jan 2011Java200.28554 
wad07 apr 2004C2?.??564 
liulz06 sep 2008C++400.01594 
liulz06 sep 2008C++500.01600 
mathematic17 sep 2012C++100.04612 
liulz05 sep 2008C++100.01625 
xavier24 jul 2008C++100.02625 
Philip_PV09 apr 2009C++200.01642 
ankorol29 nov 2005C++100.02648 
Philip_PV09 apr 2009C++100.01655 
Languages
C++
58
FPC
23
Kylix
11
C
6
Java
5
Ruby
2
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 

Way among sticks

Time limit = 5 second(s)

Memory limit = 10

There are some stick on the plane. Their ends have integer coordinates. Two points A and B has integer coordinates and don't lie on a stick.

Your program should determine whether there is continuous way from A to B not crossing sticks.

Input First two line contain coordinates of point A and point B. Next line contains number of sticks N. In the next N lines coordinates of stick ends are given. Each line contains four numbers x1, y1, x2, y2, separated with space.

Output YES or NO.

Input#1
0 0
10 0
1
2 2 2 -2
Output#1
YES

Input#2
0 0
10 0
4
-4 -4 4 -4
4 -4 4 4
4 4 -4 4
-4 4 -4 -4
Output#2
NO

Author:
Voroztsov Artem
26 march 2003

<PREV | Problem set | Search related messages | NEXT>


© acm.mipt DevGroup
The page was generated in 200ms

SW soft NIX
ID = 34.204.176.125