/*
題意:一個無限的棋盤,黑白相間,現(xiàn)畫出一個多邊形,問黑白格子的數(shù)目 ,多邊形的邊是平行于x,y軸
抄watashi Orz
用類似求多邊形的面積的方法
對一個處于第一象限的矩形,要求面積的話,可以對平行于y軸的邊處理,答案就是外邊的邊跟y軸形成的區(qū)域
減去內(nèi)邊的邊跟y軸形成的區(qū)域
而求跟y皺形成的區(qū)域可用 原點(diǎn)第一個點(diǎn)形成的區(qū)域 - 原點(diǎn)第二個點(diǎn)形成的區(qū)域
對于其他象限,發(fā)現(xiàn)面積的符號就是x,y坐標(biāo)的符號相乘!!!
- +
+ -
而對于原點(diǎn)跟(x,y)形成區(qū)域的黑格子,x,y坐標(biāo)為正的就是所有 奇數(shù)*奇數(shù) + 偶數(shù)*偶數(shù) 的格子
若其中有坐標(biāo)為負(fù),就將該坐標(biāo)的奇數(shù)改為偶數(shù)
好神奇
*/
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
const int INF = 1000000000;
const int MAXN = 10086;
inline int odd(int x)
{
return x >= 0 ? (x+1)/2 : x/2;
}
inline int even(int x)
{
return x - odd(x);
}
#define gao()\
{\
if(y1 == y2)\
{\
all += (long long)x1*y1;\
b += (long long)odd(x1)*odd(y1) + (long long)even(x1)*even(y1);\
all -= (long long)x2*y2;\
b -= (long long)odd(x2)*odd(y2) + (long long)even(x2)*even(y2);\
}\
}\
int main()
{
#ifdef ONLINE_JUDGE
#else
freopen("in","r",stdin);
#endif
int n;
while( ~scanf("%d",&n) )
{
int x0 , y0 , x1, y1 , x2 , y2;
long long all = 0 , b = 0;
scanf("%d%d",&x0,&y0);
x1 = x0;
y1 = y0;
for(int i = 1 ; i < n; i++)
{
scanf("%d%d",&x2,&y2);
gao();
x1 = x2;
y1 = y2;
}
x2 = x0;
y2 = y0;
gao();
printf("%lld %lld\n",b , all-b);
}
return 0;
}