Hide

Problem H
Space Spuds

Congratulations! You have been selected for a new game show where you try to live the lives of your favorite fictional characters. In order to boost ratings, the producers decide that you are going to get to try your hand at living alone on Mars a-la The Martian. Now, after a long journey to the red planet, you are getting ready to start your space adventure!

Or so you thought... As it turns out, farming potatoes in space is a lot of hard work. Not only do you need the proper soil, a steady water supply and a stable environment, but you also need a good sized enclosure in which to farm them.

Luckily, you know from your extensive astronaut training that there is an optimum distance that each potato must be from other potatoes in order to achieve maximum growth while still fitting in the most potatoes (for the purposes of simplicity, we are going to call this distance a spud). So you decide to mark a grid of 1 spud x 1 spud blocks inside of your martian greenhouse and mark off the perimeter of your potato-planting area at integer locations on the grid. Unfortunately, the area is not a simple shape because various immovable pieces of equiptment are scattered through the planting area.

If each integer point within, but not on, the perimeter of the grid is able to grow one potato, how many potatoes will a given enclosure be able to grow?

\includegraphics[width=0.5\textwidth ]{spacespuds.png}

Input

Each input corresponds to one test case. The first line contains a single integer $n$ ($n > 3$). The next $n$ lines contain two integers ($x_ i$, $y_ i$) denoting the $i^{th}$ point in the perimeter of the area. For purposes of simplicity, assume that the points are listed in order such that each point shares an edge with the point directly preceeding it and the point directly following it. Additionally, your traversal of these points will be made in the clockwise direction.

Output

For each test case, output the maximum number of potatoes that can be planted in the enclosure.

Sample Input 1 Sample Output 1
4
5 0
0 -4
-2 0
0 4
26
Sample Input 2 Sample Output 2
5
0 2
3 2
4 0
-2 -4
-4 -1
23

Please log in to submit a solution to this problem

Log in