PEG Test '14 - Earth

View as PDF

Submit solution

Points: 3
Time limit: 1.0s
Memory limit: 16M

Authors:
Problem type
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 x and y, representing the coordinates of The Boulder at the moment Toph raises the walls.
The second line contains four integers x_1, y_1, x_2, and y_2 (1 \le x_1 < x_2 \le 10^7; 1 \le y_1 < y_2 \le 10^7), the locations of the walls.
x_1 and x_2 are the x-coordinates of the vertical walls while y_1 and y_2 are the y-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


  • -3
    Ehsian  commented on Nov. 25, 2020, 11:17 p.m. edited

    I'm wondering why test case #4 is wrong.

    Edit: Ight nevermind I'm just an idiot


    • 3
      Dingledooper  commented on Nov. 25, 2020, 11:25 p.m.

      The second line of input is read as x1 y1 x2 y2, not x1 x2 y1 y2.


  • -7
    DorshReal  commented on Nov. 20, 2020, 9:39 p.m.

    This comment is hidden due to too much negative feedback. Show it anyway.