304897: CF930D. Game with Tokens

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Game with Tokens

题目描述

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?

输入输出格式

输入格式


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.

输出格式


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

输入输出样例

输入样例 #1

4
-2 -1
0 1
0 -3
2 -1

输出样例 #1

4

输入样例 #2

4
-2 0
-1 1
0 -2
1 -1

输出样例 #2

2

输入样例 #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

输出样例 #3

4

说明

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: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF930D/9cafc5b5a915244f359ed7d639551c9e3e967f72.png) The second example: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF930D/7a4517e8c3fec7bb965f7f3524bb8530614362f2.png) In the third example the white tokens should be located in the inner square $ 2×2 $ , to make the black player win. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF930D/fbaddc982f079c3a3bd9f0328eb525dca749c972.png)

Input

暂时还没有翻译

加入题单

上一题 下一题 算法标签: