#P4261. [Code+#3] 白金元首与克劳德斯
[Code+#3] 白金元首与克劳德斯
Description
On the -Cartesian coordinate plane, there are axis-aligned rectangular clouds. Each cloud is represented by a 5-tuple , where is the coordinate of the lower-left corner, is the width along the -axis, is the length along the -axis, and is the moving direction ( for horizontal, for vertical). Specifically, a cloud with moves continuously along the positive -axis at a speed of 1 unit length per second, and a cloud with moves continuously along the positive -axis at a speed of 1 unit length per second.
The Führer observes that all clouds have no overlapping area at this moment. He marks this moment as time . He wants to know, for any moment in and any single point on the plane, what is the maximum number of clouds that can simultaneously cover it. A point is covered by a cloud at some moment if and only if it lies strictly inside the rectangle occupied by the cloud at that moment (excluding the boundary).
You need to write a program to satisfy his curiosity.
Input Format
The first line contains a positive integer — the number of test cases. Then follow test cases in the format below, with no blank lines between them.
- Line 1: a positive integer — the number of clouds.
- Then lines follow: each line contains five space-separated integers , , , , and — describing the state of one cloud at time .
Output Format
For each test case, output one line — the maximum number of clouds that can cover some point at any time.
3
1
0 0 1 1 0
3
0 -10 10 10 1
10 0 10 10 1
-10 0 10 10 0
3
0 10 10 10 1
10 20 10 10 1
10 0 10 10 0
1
2
2
Hint
In the 1st test group, at any time, any point is covered by at most one cloud.
In the 2nd test group, the following figure from left to right illustrates the situations at time 0, time 4, and time 11.

In the 3rd test group, time 0 corresponds to the situation at time 20 in the 2nd test group. In this group, during times in , there are always 2 clouds covering the same point. Please note that the range includes times before time .
Constraints:
For all testdata, , , , .

Credit: https://www.luogu.org/discuss/show?postid=35727
Translated by ChatGPT 5
京公网安备 11011102002149号