#K64477. Determine Uncovered Point on a Table of Rectangular Plates
Determine Uncovered Point on a Table of Rectangular Plates
Determine Uncovered Point on a Table of Rectangular Plates
You are given a table that is defined as the area \(\left[-10^9, 10^9\right] \times \left[-10^9, 10^9\right]\). There are \(n\) rectangular plates placed on the table. Each rectangular plate is axis-aligned and is specified by four integers \(x_1, y_1, x_2, y_2\) representing two opposite corners.
The task is to determine whether there exists a point on the table that is not covered (i.e. not under the shadow) of any rectangular plate. In other words, if the union of the shadows of these rectangular plates completely covers the table, output NO
; otherwise, output YES
.
Note: The table has fixed boundaries, and the rectangular plates may or may not overlap. The solution should simply determine if the overall bounding box of all rectangles covers the whole table \(\left[-10^9, 10^9\right] \times \left[-10^9, 10^9\right]\) or not.
inputFormat
The first line of input contains a single integer \(n\) representing the number of rectangular plates.
Each of the next \(n\) lines contains 4 space-separated integers \(x_1\), \(y_1\), \(x_2\), \(y_2\) which denote the coordinates of two opposite corners of a rectangle.
All input is provided via standard input.
outputFormat
Output a single line: YES
if there exists at least one point on the table that is not covered by any rectangle, otherwise output NO
. The output is written to standard output.
3
-5 0 5 2
-1 -2 2 1
-3 -3 0 0
YES