#P1856. [IOI 1998 / USACO5.5] 矩形周长 Picture
[IOI 1998 / USACO5.5] 矩形周长 Picture
Description
Write a program to compute the perimeter.

The rectangles are shown in Figure 1.

The boundary of the union of all rectangles is shown in Figure 2.
All rectangle vertices have integer coordinates.
Input Format
The first line of the input contains an integer , the number of rectangles. Each of the next lines gives the coordinates of the lower-left corner and the upper-right corner of a rectangle.
Output Format
Output a single positive integer, the perimeter of the union of all rectangles.
7
-15 0 5 10
-5 8 20 25
15 -4 24 14
0 -6 16 4
2 15 10 22
30 10 36 20
34 0 40 16
228
Hint
Constraints
For all testdata, , and all coordinate values are in the range to .
Translated by ChatGPT 5
京公网安备 11011102002149号