Alien
InterviewTime limit2sMemory limit128 MB
Given a point and n axis-aligned rectangles, decide whether any rectangle contains the point, boundaries included.
- Level
Easy1 of 10
- Topics
- Geometry, Implementation, Brute force, Array
- Solved
- No attempts yet
Problem
After winning yet another competition, Bakhytzhan, Askar, and Artem were walking through the Old Square. They stopped when they noticed some interesting rectangle-shaped lines drawn on the asphalt. People said these rectangles were the marks left by alien ships that had landed on the square the night before.
Each alien ship occupies an axis-aligned rectangular region on the Cartesian plane. Now they want to know whether any alien ship had landed exactly on the spot where Bakhytzhan stopped. A ship is considered to have landed on that spot if its rectangular region contains Bakhytzhan's coordinates (points on the boundary are included).
Input
The first line contains a single integer , the number of alien ships ().
The second line contains two integers and , Bakhytzhan's coordinates ().
Each of the following lines describes one ship with two pairs of integer coordinates: the first pair , is the bottom-left corner of the ship (rectangle) and the second pair , is the top-right corner ().
Output
Print Yes if any alien ship had landed on the spot where Bakhytzhan stopped, and No otherwise.