CF333B.Chips

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Gerald plays the following game. He has a checkered field of size n×nn×n cells, where mm various cells are banned. Before the game, he has to put a few chips on some border (but not corner) board cells. Then for n1n-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 00 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 nn and mm ( 2<=n<=10002<=n<=1000 , 0<=m<=1050<=m<=10^{5} ) — the size of the field and the number of banned cells. Next mm lines each contain two space-separated integers. Specifically, the ii -th of these lines contains numbers xix_{i} and yiy_{i} ( 1<=xi,yi<=n1<=x_{i},y_{i}<=n ) — the coordinates of the ii -th banned cell. All given cells are distinct.

Consider the field rows numbered from top to bottom from 1 to nn , and the columns — from left to right from 1 to nn .

输出格式

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).

首页