PEG Test – Oct 3rd, 2014
Earthbending is an art which allows its users to manipulate earth and rocks in all of their various forms. Earthbenders are strong, persistent, and enduring people. The secret to being a good earthbender is waiting and listening for the right moment to strike decisively.
Aang, Katara, and Sokka are currently scouring the entire earth kingdom in search of a proper earthbending teacher for Aang. In the town of Gaoling, they have stumbled upon the Blind Bandit (i.e. a young, blind girl named Toph from a rich earth-kingdom family) in an earthbending tournament with The Boulder. Aang immediately knew that Toph was the one after she effortlessly defeated The Boulder, but incidentally defeated Toph with his airbending to claim the prize money himself after failing to convince her. Bitter about losing the prize money, The Boulder gathered the other earthbenders of the tournament and kidnapped Aang. Toph decides to rescue Aang and confronts The Boulder. Now, she must face the wrath of a giant earthbending wrestler who is closing in on her.
No sweat! It's the perfect time for Toph to test out her new technique – the Earth Cage. Toph creates an earth cage by erecting 4 rocky walls on the 2D-plane such that they form a rectangle whose sides are parallel to the X and Y axes. However, because Toph is blind, she cannot be instantly sure if her earth cage has trapped her opponent.
Given The Boulder's position and the locations of the four walls of the earth cage, determine if Toph has successfully trapped him. The Boulder will always be directly inside or outside of the walls.
Input Specification
The first line contains two integers and , representing the
coordinates of The Boulder at the moment Toph raises the walls.
The second line contains four integers , , , and
, the locations of the
walls.
and are the -coordinates of the vertical walls while and
are the -coordinates of the horizontal walls.
Output Specification
Output Yes
if The Boulder is trapped, or No
otherwise.
Sample Input
4 6
3 5 5 7
Sample Output
Yes
Comments
I'm wondering why test case #4 is wrong.
Edit: Ight nevermind I'm just an idiot
The second line of input is read as
x1 y1 x2 y2
, notx1 x2 y1 y2
.This comment is hidden due to too much negative feedback. Show it anyway.