DMOPC '15 Contest 3 P1 - Quality Scenes

View as PDF

Submit solution


Points: 3 (partial)
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type

FatalEagle wants to share some top quality video clips with his friends. He has two clips that he cut from a video: one that goes from time a to time b and one that goes from time c to time d. Since he doesn't want to waste his friends' time, FatalEagle would like to know if the two clips overlap or not.

Formally, he wants to know if there exists an infinite amount of real numbers r such that a \le r \le b and c \le r \le d. See the sample inputs for better clarification.

Input Specification

The first line of input will contain a.
The second line of input will contain b.
The third line of input will contain c.
The fourth line of input will contain d.

It's guaranteed that 1 \le a < b \le 10 and 1 \le c < d \le 10.

Output Specification

If the clips overlap, output YES. Otherwise, output NO.

Sample Input 1

1
2
3
4

Sample Output 1

NO

Explanation for Sample Output 1

The clips do not overlap, 1 unit of time from 2 to 3 is skipped in between.

Sample Input 2

1
2
2
3

Sample Output 2

NO

Explanation for Sample Output 2

The clips share only one moment of time at 2, therefore we consider they don't overlap (and the second clip just continues from the first clip).

Sample Input 3

3
5
1
6

Sample Output 3

YES

Explanation for Sample Output 3

The first clip is contained in the second clip.

Sample Input 4

3
7
5
8

Sample Output 4

YES

Explanation for Sample Output 4

The clips overlap from time 5 to time 7.


Comments


  • 15
    bobhob314  commented on Dec. 10, 2015, 4:15 p.m.

    video clips

    ( ͡° ͜ʖ ͡°)


    • -3
      moladan123  commented on Dec. 10, 2015, 7:07 p.m. edited

      Video clips of blitz chess. Because we need the maximum chess in as little time as possible. `

      ( ͡° ͜ʖ ͡°)


      • 5
        bobhob314  commented on Dec. 10, 2015, 10:03 p.m.

        you killed the joke