#K86377. Range Overlap Detection
Range Overlap Detection
Range Overlap Detection
You are given two integer ranges in each test case. The ranges are represented as intervals \([a, b]\) and \([c, d]\). Two ranges are considered to overlap if and only if $$a \le d$$ and $$c \le b$$. Note that if the ranges touch at the boundaries (i.e. one range ends exactly where the other begins), they are considered to overlap.
Your task is to determine for each test case whether the two ranges overlap. For each case, output "Overlap" if the ranges overlap, and "No Overlap" otherwise.
inputFormat
The input is read from stdin
and has the following format:
T a b c d a b c d ... (T test cases)
Here, T
is the number of test cases. Each test case consists of four space-separated integers, representing two ranges: [a, b] and [c, d].
outputFormat
For each test case, print a line to stdout
with the string "Overlap" if the two ranges overlap; otherwise, print "No Overlap".
5
1 3 2 4
5 8 9 10
100 200 150 250
10 20 15 25
30 40 20 29
Overlap
No Overlap
Overlap
Overlap
No Overlap
</p>