Problem Statement | |||||||||||||
There are some rectangles on a plane. Determine whether a point exists such that above, below, to the left, and to the right of the point lies an interior point of a rectangle. This point must not lie inside or on the boundary of any of the given rectangles. You are given a String[] rectangles, each element of which is formatted as "X1 Y1 X2 Y2", where X1 and Y1 are the coordinates of the lower left corner of a rectangle, and X2 and Y2 are the coordinates of the upper right corner. You are to return a String, "YES" if such a point exists and "NO" otherwise. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
- | Point A(xa, ya) is above point B(xb, yb) if xa = xb and ya > yb. | ||||||||||||
- | Point A(xa, ya) is below point B(xb, yb) if xa = xb and ya < yb. | ||||||||||||
- | Point A(xa, ya) is to the left of point B(xb, yb) if xa < xb and ya = yb. | ||||||||||||
- | Point A(xa, ya) is to the right of point B(xb, yb) if xa > xb and ya = yb. | ||||||||||||
Constraints | |||||||||||||
- | rectangles will contain between 0 and 50 elements, inclusive. | ||||||||||||
- | Each element of rectangles will be formatted as "X1 Y1 X2 Y2". | ||||||||||||
- | X1, Y1, X2, and Y2 will each be an integer between 0 and 10000, inclusive, with no extra leading zeros. | ||||||||||||
- | X2 will be greater than X1, and Y2 will be greater than Y1. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
|