Solved by 105 users: ...
UserDateAttemptTimeCMSC
bush`22 apr 2006`Ruby200.05341
tomek`15 apr 2006`C++200.02454
david_it21`24 apr 2008`Ruby100.09502
tomek`15 apr 2006`C++100.01537
mansur115`03 jan 2011`Java200.28554
wad`07 apr 2004`C2?.??564
liulz`06 sep 2008`C++400.01594
liulz`06 sep 2008`C++500.01600
mathematic`17 sep 2012`C++100.04612
liulz`05 sep 2008`C++100.01625
xavier`24 jul 2008`C++100.02625
Philip_PV`09 apr 2009`C++200.01642
ankorol`29 nov 2005`C++100.02648
Philip_PV`09 apr 2009`C++100.01655
 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 DevGroupThe page was generated in 200ms