CF930D.Game with Tokens

省选/NOI-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 10100500 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?

考虑以下两人参与的游戏。游戏中有一个白棋子和若干个黑棋子。每个棋子均被放置在平面上具有整数坐标 xx 和 yy 的点上。

两名玩家轮流进行操作,白方先行。在每一轮中,玩家将其所有同色棋子整体向上、下、左或右移动 1 单位。黑方玩家可为每个黑棋子独立选择移动方向。

白方完成一轮操作后,白棋子所在位置不能与任意一个黑棋子的位置重合。棋子位置无其他限制:黑棋子之间可以位于同一位置;在黑方操作后以及初始时刻,白棋子可以与某个黑棋子位于同一位置。若在某一时刻白方无法进行任何合法操作,则白方判负。若白方成功完成了 1010050010^{100500} 次操作,则白方获胜。

你需要解决如下问题:给定所有黑棋子的初始位置(保证这些初始位置互不相同),问:白棋子初始可放置在多少个不同的位置上,使得在双方均采取最优策略的前提下,黑方必胜?

输入格式

The first line contains a single integer n (1 ≤ n ≤ 105) — the number of black points.

The (i + 1)-th line contains two integers x__i, y__i ( - 105 ≤ x__i, y__i,  ≤ 105) — 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.

第一行包含一个整数 nn(1≤n≤1051 \leq n \leq 10^5)—— 黑点的数量。

第 (i+1)(i + 1) 行包含两个整数 xix_i、yiy_i(−105≤xi,yi≤105-10^5 \leq x_i, y_i \leq 10^5)—— 第 ii 个黑棋子初始所在位置的坐标。

保证所有黑棋子的初始位置互不相同。

输出格式

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:

The second example:

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

在第一和第二个示例中,黑色棋子的初始位置用黑点表示,白色棋子的可能位置(使得黑方获胜)用白点表示。

第一个示例:

第二个示例:

在第三个示例中,白色棋子应位于内部 2×22 \times 2 的正方形区域内,才能使黑方获胜。

输入解题思路,AI测评打分。不知道怎么写?

首页