luogu#P5182. 棋盘覆盖

棋盘覆盖

Problem Description

Given an NN by NN chessboard, it is known that some cells are forbidden to place on.

Find the maximum number of dominoes of length 22 and width 11 that can be placed on the board. The boundary of each domino must align with the grid lines (each domino occupies two cells), and no two dominoes may overlap.

Input Format

The first line contains two integers NN and tt, where tt is the number of forbidden cells.

The next tt lines each contain two integers xx and yy, indicating that the cell at row xx and column yy is forbidden. Row and column indices start from 11.

Output Format

Output one integer, the result.

8 0
32

Hint

1N1001 \le N \le 1000t1000 \le t \le 100

Translated by ChatGPT 5