Codeforces Round 468 (Div. 1, based on Technocup 2018 Final Round)
D
Game with Tokens
Codeforces
2500
原题
← CE →
翻译中…

Consider the following game for two players. There is one white token and some number of black tokens. Each token is placed on a plane in a point with integer coordinates $*x*$ and $*y*$.

翻译中…

The players take turn making moves, white starts. On each turn, a player moves all tokens of their color by $1$ to up, down, left or right. Black player can choose directions for each token independently.

翻译中…

After a turn of the white player the white token can not be in a point where a black token is located. There are no other constraints on locations of the tokens: positions of black tokens can coincide, after a turn of the black player and initially the white token can be in the same point with some black point. If at some moment the white player can't make a move, he loses. If the white player makes $10^{100500}$ moves, he wins.

翻译中…

You are to solve the following problem. You are given initial positions of all black tokens. It is guaranteed that initially all these positions are distinct. In how many places can the white token be located initially so that if both players play optimally, the black player wins?

翻译中…

Input

翻译中…

The first line contains a single integer $*n*$ ($1 ≤ *n* ≤ 10^{5}$) — the number of black points.

翻译中…

The ($*i* + 1$)-th line contains two integers $*x*_{*i*}$, $*y*_{*i*}$ ($- 10^{5} ≤ *x*_{*i*}, *y*_{*i*},  ≤ 10^{5}$) — the coordinates of the point where the $*i*$-th black token is initially located.

翻译中…

It is guaranteed that initial positions of black tokens are distinct.

翻译中…

Output

翻译中…

Print the number of points where the white token can be located initially, such that if both players play optimally, the black player wins.

翻译中…

Note

翻译中…

In the first and second examples initial positions of black tokens are shown with black points, possible positions of the white token (such that the black player wins) are shown with white points.

翻译中…

The first example: image

翻译中…

The second example: image

翻译中…

In the third example the white tokens should be located in the inner square $2 × 2$, to make the black player win. image

翻译中…

样例

Input #1
4
-2 -1
0 1
0 -3
2 -1
Output #1
4
InputCopy OutputCopy
Input #2
4
-2 0
-1 1
0 -2
1 -1
Output #2
2
InputCopy OutputCopy
Input #3
16
2 1
1 2
-1 1
0 1
0 0
1 1
2 -1
2 0
1 0
-1 -1
1 -1
2 2
0 -1
-1 0
0 2
-1 2
Output #3
4
InputCopy OutputCopy
题目信息
题号
930D
时间限制
2 s
内存限制
256 MB
标签
数据结构
博弈论
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。