#K94932. Event Overlap Checker

    ID: 38751 Type: Default 1000ms 256MiB

Event Overlap Checker

Event Overlap Checker

You are given a list of events, each defined by a start time and an end time. Your task is to determine if any two events overlap. Two events are considered overlapping if one event starts strictly before the previous event has finished.

Formally, given events \(E_i = (s_i, e_i)\), after sorting by start times, check if for any two consecutive events, \(s_j < e_{j-1}\). If so, output "YES", otherwise output "NO".

Note: If events just touch (e.g. one event ends exactly when the next starts), they are not considered overlapping.

inputFormat

The first line contains an integer \(N\), the number of events.

Each of the following \(N\) lines contains two space-separated integers \(s_i\) and \(e_i\) representing the start and end times of the event.

outputFormat

Output a single string: "YES" if any two events overlap, otherwise "NO".

## sample
3
1 5
6 10
11 15
NO