luogu#P5030. 长脖子鹿放置
长脖子鹿放置
Background
As everyone knows, in chess, we have rooks, knights, queens, bishops, and long-necked giraffes.
Problem Description
As shown in the picture, the chess piece "long-necked giraffe" is similar to the knight in Chinese chess, but it attacks in a "目" shape, and there is no rule like the Chinese chess "blocking the horse's leg" (because the long-necked giraffe has no legs).

Given an chessboard, some cells are forbidden to place pieces. Find the maximum number of long-necked giraffes that can be placed on the board such that none of them can attack each other.
Input Format
The first line contains two positive integers . Here, is the number of cells where placing a long-necked giraffe is forbidden.
Lines to each contain two integers , indicating a forbidden cell.
It is not guaranteed that the forbidden cells are all distinct.
Output Format
Output one positive integer in a single line, representing the maximum number of long-necked giraffes that can be placed.
2 2 1
1 1
3
8 7 5
1 1
5 4
2 3
4 7
8 3
28
Hint
For of the testdata, .
For of the testdata, .
For of the testdata, .
For of the testdata, .
For of the testdata, .
Translated by ChatGPT 5