#P1382. 楼房
楼房
Description
There are buildings on the horizon (the axis), and each building is represented as a rectangle.
The -th rectangle is represented by three integers : its bottom-left corner is at and its top-right corner is at .
The horizon has height . Subject to minimizing the skyline polyline length (i.e., without redundant points), output the skyline from left to right.
Input Format
The first line contains an integer , the number of rectangles.
Each of the following lines contains integers describing the -th rectangle.
Output Format
The first line contains an integer , the number of nodes.
Each of the following lines contains one coordinate, representing a node on the skyline.
Traverse the skyline from left to right and output the nodes in order.
Note: The -coordinates of the first and the last node are both .
2
3 0 2
4 1 3
6
0 0
0 3
1 3
1 4
3 4
3 0
5
3 -3 0
2 -1 1
4 2 4
2 3 7
3 6 8
14
-3 0
-3 3
0 3
0 2
1 2
1 0
2 0
2 4
4 4
4 2
6 2
6 3
8 3
8 0
Hint
Sample 2 as shown:


Constraints:
For of the testdata, .
For another of the testdata, .
For of the testdata, , , .
Translated by ChatGPT 5
京公网安备 11011102002149号