#C10814. Detecting Overlapping Tasks
Detecting Overlapping Tasks
Detecting Overlapping Tasks
You are given a list of tasks, where each task is represented by a pair of integers indicating the start and end times. Two tasks are said to be overlapping if the end time of one task is greater than the start time of the next task when the tasks are sorted by their start times.
Your task is to determine if any two tasks overlap. More formally, given tasks \(T = [(s_1, e_1), (s_2, e_2), \dots, (s_n, e_n)]\), after sorting by \(s_i\), check if there exists an index \(i\) such that:
\(e_i > s_{i+1}\)
If such an index exists, output True
. Otherwise, output False
.
inputFormat
The first line contains an integer \(N\) representing the number of tasks. Each of the following \(N\) lines contains two space-separated integers, representing the start and end times of a task respectively.
outputFormat
Output a single line with True
if any two tasks overlap, or False
otherwise.
3
1 5
6 10
11 15
False
</p>