Codeforces Round 194 (Div. 1)
B
Chips
Codeforces
1800
原题
← AC →
翻译中…

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.

翻译中…

Input

翻译中…

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*$.

翻译中…

Output

翻译中…

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

翻译中…

Note

翻译中…

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 #1
3 1
2 2
Output #1
0
InputCopy OutputCopy
Input #2
3 0
Output #2
1
InputCopy OutputCopy
Input #3
4 3
3 1
3 2
3 3
Output #3
1
InputCopy OutputCopy
题目信息
题号
333B
时间限制
1 s
内存限制
256 MB
标签
贪心

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