#C11345. Overlapping Intervals

    ID: 40651 Type: Default 1000ms 256MiB

Overlapping Intervals

Overlapping Intervals

Given a series of time intervals, determine whether any two intervals overlap. An interval is represented as [s, e] where \(s < e\). Two intervals \([s_1, e_1]\) and \([s_2, e_2]\) are said to overlap if \(s_2 < e_1\) when the intervals are sorted by their start times. Note that intervals that touch but do not intersect (for example, [1,2] and [2,3]) are not considered overlapping.

The input begins with an integer \(N\) representing the number of intervals. Each of the following \(N\) lines contains two space-separated integers representing the start time and end time of an interval. Your task is to output "True" if any pair of intervals overlap and "False" otherwise.

inputFormat

The first line contains an integer \(N\) (\(1 \le N \le 10^5\)), the number of intervals. Each of the next \(N\) lines contains two integers \(s\) and \(e\) (with \(s < e\)), representing the start and end times of an interval.

outputFormat

Output a single line: "True" if any two intervals overlap, otherwise "False".

## sample
3
1 5
6 10
4 8
True