301763: CF333B. Chips

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

Description

Chips

题意翻译

题意:有一个n*n的棋盘,其中有m个格子被禁止。在游戏开始前要将一些芯片(?)放到四条边上(但不能是角上)。游戏开始后,每次操作将每一个芯片移动到它四周四格中某一格,并且要用n-1次操作将所有的芯片移到与其初始位置相对的一条边上。在移动过程中,不能有任何芯片经过被禁止的格子,不能有任何多个芯片重叠,不能在一次操作中使两个芯片交换位置(在将两个芯片放在相对的两条边上相对的位置时,就会发生)。问如果要求完成游戏,最多可以在棋盘上放几个芯片。

题目描述

Gerald plays the following game. He has a checkered field of size $ n×n $ cells, where $ m $ various cells are banned. Before the game, he has to put a few chips on some border (but not corner) board cells. Then for $ n-1 $ minutes, Gerald every minute moves each chip into an adjacent cell. He moves each chip from its original edge to the opposite edge. Gerald loses in this game in each of the three cases: - At least one of the chips at least once fell to the banned cell. - At least once two chips were on the same cell. - At least once two chips swapped in a minute (for example, if you stand two chips on two opposite border cells of a row with even length, this situation happens in the middle of the row). In that case he loses and earns $ 0 $ points. When nothing like that happened, he wins and earns the number of points equal to the number of chips he managed to put on the board. Help Gerald earn the most points.

输入输出格式

输入格式


The first line contains two space-separated integers $ n $ and $ m $ ( $ 2<=n<=1000 $ , $ 0<=m<=10^{5} $ ) — the size of the field and the number of banned cells. Next $ m $ lines each contain two space-separated integers. Specifically, the $ i $ -th of these lines contains numbers $ x_{i} $ and $ y_{i} $ ( $ 1<=x_{i},y_{i}<=n $ ) — the coordinates of the $ i $ -th banned cell. All given cells are distinct. Consider the field rows numbered from top to bottom from 1 to $ n $ , and the columns — from left to right from 1 to $ n $ .

输出格式


Print a single integer — the maximum points Gerald can earn in this game.

输入输出样例

输入样例 #1

3 1
2 2

输出样例 #1

0

输入样例 #2

3 0

输出样例 #2

1

输入样例 #3

4 3
3 1
3 2
3 3

输出样例 #3

1

说明

In the first test the answer equals zero as we can't put chips into the corner cells. In the second sample we can place one chip into either cell (1, 2), or cell (3, 2), or cell (2, 1), or cell (2, 3). We cannot place two chips. In the third sample we can only place one chip into either cell (2, 1), or cell (2, 4).

Input

题意翻译

题意:有一个n*n的棋盘,其中有m个格子被禁止。在游戏开始前要将一些芯片(?)放到四条边上(但不能是角上)。游戏开始后,每次操作将每一个芯片移动到它四周四格中某一格,并且要用n-1次操作将所有的芯片移到与其初始位置相对的一条边上。在移动过程中,不能有任何芯片经过被禁止的格子,不能有任何多个芯片重叠,不能在一次操作中使两个芯片交换位置(在将两个芯片放在相对的两条边上相对的位置时,就会发生)。问如果要求完成游戏,最多可以在棋盘上放几个芯片。

加入题单

上一题 下一题 算法标签: