P3072 [USACO13FEB] Perimeter S

Background

征求翻译。如果你能提供翻译或者题意简述,请直接发讨论,感谢你的贡献。

Description

Farmer John has arranged N hay bales (1

Input Format

\* Line 1: The number of hay bales, N. \* Lines 2..1+N: Each line contains the (x,y) location of a single hay bale, where x and y are integers both in the range 1..1,000,000. Position (1,1) is the lower-left cell in FJ's field, and position (1000000,1000000) is the upper-right cell.

Output Format

\* Line 1: The perimeter of the connected region of hay bales.

Explanation/Hint

The connected region consisting of hay bales looks like this: XX X XX XXX The length of the perimeter of the connected region is 14 (for example, the left side of the region contributes a length of 3 to this total). Observe that the hole in the middle does not contribute to this number.