9362: CCC '22 J5 - Square Pool
Description
Input
The first line of input will be an integer $N$ with $N≥2$.
The second line will be the positive integer $T$ where $T<N^2$.
The remaining input will be $T$ lines, each representing the location of a single tree. The location is given by two positive integers, $R$ and then $G$, separated by a single space. Each tree is located at row $R$ and column $C$ where rows are numbered from top to bottom from 1 to N and columns are numbered from left to right from 1 to N.
No two trees are at the same location.
Output
Constraints
$T \leq 100$
Sample 1 Input
5
1
2 4
Sample 1 Output
3
A picture of the yard is below. The location of the tree is marked by tree and one of several 3-by-3 squares that do not contain the tree is highlighted. All larger squares contain a tree.
Sample 2 Input
15
8
4 7
4 1
14 11
10 6
13 4
4 10
10 3
9 14
Sample 2 Output
7
A picture of the yard is below. The location of each tree is marked by tree and one of several 7-by-7 squares that do not contain a tree is highlighted. All larger squares contain a tree.