#C6764. Overlapping Rectangles
Overlapping Rectangles
Overlapping Rectangles
This problem requires you to determine whether two axis-aligned rectangles overlap. Each rectangle is defined by its bottom-left and top-right coordinates.
Problem Statement
Given T test cases, each test case provides 8 floating-point numbers corresponding to the coordinates: xbl_A, ybl_A, xtr_A, ytr_A, xbl_B, ybl_B, xtr_B, ytr_B.
Overlap Condition
Two rectangles overlap if they share any common area. They do not overlap if one rectangle is completely to the left, right, above, or below the other. The condition can be summarized as:
\(\text{Overlapping if } \neg ((x_{tr_A} < x_{bl_B}) \; \lor \; (x_{tr_B} < x_{bl_A}) \; \lor \; (y_{tr_A} < y_{bl_B}) \; \lor \; (y_{tr_B} < y_{bl_A}))\)
Input Example
1
0 0 2 2 1 1 3 3
Output Example
1
inputFormat
The input is read from standard input (stdin). The first line contains an integer T (1 ≤ T ≤ 1000) representing the number of test cases. Each of the following T lines contains 8 space-separated floating-point numbers: xbl_A, ybl_A, xtr_A, ytr_A, xbl_B, ybl_B, xtr_B, ytr_B.
outputFormat
For each test case, output a single line to standard output (stdout) containing 1 if the rectangles overlap, and 0 if they do not.
## sample1
0 0 2 2 1 1 3 3
1
</p>