#C688. Interval Overlap Checker
Interval Overlap Checker
Interval Overlap Checker
Given a set of interval pairs, determine whether the two intervals in each pair overlap. Each pair of intervals is defined by four integers \(a\), \(b\), \(c\), and \(d\) that represent the intervals \([a, b]\) and \([c, d]\). Two intervals overlap if and only if
\(\max(a,c) \le \min(b,d)\)
Your task is to output a sequence of values, where each value is 1
if the corresponding pair overlaps, and 0
otherwise.
inputFormat
The input is provided via standard input (stdin). The first line contains a single integer \(n\) denoting the number of interval pairs. Each of the next \(n\) lines contains four space-separated integers \(a\), \(b\), \(c\), and \(d\), representing the endpoints of the two intervals \([a, b]\) and \([c, d]\).
outputFormat
Print a single line to standard output (stdout) with \(n\) integers separated by spaces. The \(i\)-th integer should be 1
if the \(i\)-th pair of intervals overlaps (i.e., \(\max(a, c) \le \min(b, d)\)), or 0
otherwise.
1
1 5 4 8
1