#K62467. Schedule Conflict Checker
Schedule Conflict Checker
Schedule Conflict Checker
You are given n activities, each represented by a time interval \( [s, e) \), where \(s\) is the start time and \(e\) is the end time. Two activities are considered overlapping (and thus in conflict) if the start time of one is less than the end time of the previous one, i.e., if for any consecutive intervals \(a_i = [s_i, e_i)\) and \(a_{i+1} = [s_{i+1}, e_{i+1})\), the condition \(s_{i+1} < e_i\) holds. Note that if one activity ends exactly when another begins (i.e., \(e_i = s_{i+1}\)), there is no conflict.
Your task is to determine whether any two activities in the given schedule conflict. If no pair of activities overlap, output NO CONFLICT
; otherwise, output CONFLICT
.
inputFormat
The input is read from standard input (stdin) and has the following format:
n s1 e1 s2 e2 ... sn en
Here, the first line contains an integer n
denoting the number of activities. Each of the next n
lines contains two integers s
and e
representing the start time and end time of an activity.
outputFormat
Output a single line to standard output (stdout) containing either NO CONFLICT
if none of the activities overlap, or CONFLICT
if there is at least one overlapping pair.
2
9 10
10 12
NO CONFLICT