#P3355. 骑士共存问题
骑士共存问题
Description
On an chessboard, a knight can attack the squares shown in the figure. Some squares on the board are marked as obstacles, and knights are not allowed to enter them.

Given an chessboard and the obstacle marks, compute the maximum number of knights that can be placed on the board so that no two knights attack each other.
Input Format
The first line contains positive integers and , representing the size of the board and the number of obstacles, respectively. The following lines give the positions of the obstacles. Each line contains positive integers, representing the coordinates of an obstructed square.
Output Format
Output the maximum number of knights that can coexist.
3 2
1 1
3 3
5
Hint
Constraints
For all test points, it is guaranteed that , .
Translated by ChatGPT 5
京公网安备 11011102002149号