#C9942. Event Scheduling

    ID: 54091 Type: Default 1000ms 256MiB

Event Scheduling

Event Scheduling

You are given (n) scheduled events. Each event is represented by a pair of integers ((s, e)) denoting the start and end times, where (s < e). You are also given a new event represented as a pair ((s', e')). The task is to determine if the new event can be scheduled without overlapping any of the (n) existing events. Two events are considered non-overlapping if (e' \leq s) or (s' \geq e). Output "Yes" if the new event can be scheduled; otherwise, output "No".

inputFormat

The input is read from standard input and follows the format below:

  1. The first line contains a single integer (n), representing the number of scheduled events.
  2. The next (n) lines each contain two space-separated integers (s) and (e), representing the start and end times of an event.
  3. The last line contains two space-separated integers (s') and (e'), representing the new event's start and end times.

outputFormat

Output a single line to standard output containing "Yes" if the new event can be scheduled without overlapping any existing events, otherwise "No".## sample

1
1 5
6 10
Yes

</p>