#P12351. 「HCOI-R2」哀之距
「HCOI-R2」哀之距
Description
The cat that Ai encountered can be treated as a plane with rectangles on it.
The coordinates of the bottom-left corner of the -th rectangle are , and the coordinates of the top-right corner are .
Find the distance between the two rectangles with the largest distance.
The distance between two rectangles is defined as the minimum Chebyshev distance between any pair of points where one point lies in the first rectangle and the other in the second one (including the boundaries).
Chebyshev distance: The Chebyshev distance between and is .
Input Format
The first line contains an integer , representing the number of rectangles.
In the next lines, the -th line consists of four integers , representing the -th rectangle.
Output Format
A single integer which represents the maximum distance between any two rectangles.
5
1 2 5 2
4 0 4 4
3 3 7 3
0 5 3 5
2 1 2 6
3
Hint
Constraints
This problem uses subtasks.
- Subtask 0 (15 pts): , .
- Subtask 1 (20 pts): .
- Subtask 2 (25 pts): .
- Subtask 3 (40 pts): No additional constraints.
For all test cases, it is guaranteed that , , .
京公网安备 11011102002149号