eolymp
bolt
Try our new interface for solving problems
Problems

Square Counting

Square Counting

A simple polygon with vertices having integer coordinates is placed on a checker board. Determine the number of light and dark squares completely encompassed by the polygon. \includegraphics{https://static.e-olymp.com/content/7c/7c6363daf25b10a8b0736fab56389435793083c1.jpg} \InputFile Contains several tests (at most \textbf{25}). Each test case starts with the number \textbf{n }(\textbf{3 }≤ \textbf{n }≤ \textbf{100}) of vertices in the polygon. Each of the next \textbf{n} lines contains two integers \textbf{x }and \textbf{y} (\textbf{0} ≤ \textbf{x }≤ \textbf{10000}, \textbf{0 }≤ \textbf{y }≤ \textbf{10000}), describing the coordinates of the polygon vertices. The input ends with a case when \textbf{n} equals \textbf{0}, which should not be processed. You can assume that the top left corner has coordinate (\textbf{0}, \textbf{0}). The picture above corresponds to the first sample input. \OutputFile For each test case, output a line containing two space separated integers, the number of light and dark squares completely encompassed by the polygon in descending order.
Time limit 1 second
Memory limit 64 MiB
Input example #1
11
2 1
6 4
10 1
15 3
13 8
15 11
9 9
11 5
7 11
1 7
4 8
4
0 0
0 1
1 1
1 0
0
Output example #1
27 25
1 0