#P15058. [UOI 2023 II Stage] Rectangles are everywhere
[UOI 2023 II Stage] Rectangles are everywhere
题目描述
Andriyko drank a lot of compote and now he's very afraid of rectangles. Andriyko's room can be mathematically represented as a rectangle with height and width . In this room, there are rectangles, each of which is completely inside the room and does not touch the points and (where is the top-left and is the bottom-right point).
Andriyko wants to go from the corner to without ever touching any of the rectangles (not even touching them). If he is at coordinate , then he can move to any of the following coordinates with one step: , , , , but only if the next coordinate does not go beyond the boundaries of the rectangle.
Determine if he can reach from one corner to the other.
输入格式
The first line contains three integers , , .
Each of the next lines contains four integers , , , --- the coordinates of the top-left and bottom-right corners of rectangle .
It is guaranteed that no rectangle touches the points and .
输出格式
Print if Andriyko can travel between the ends of the room, and otherwise.
3 4 3
0 2 1 4
1 2 3 3
2 1 3 3
NO
3 4 3
0 2 1 4
1 0 2 1
2 1 3 3
YES
提示
- ( points):
- ( points):
- ( points):
- ( points):
- ( points):
- ( points):
- ( points): no additional constraints.