Baltic Olympiad in Informatics: 2001 Day 2, Problem 1
We are given a chessboard of size , from which some fields have been removed. The task is to determine the maximum number of knights that can be placed on the remaining fields of the board in such a way that none of them check each other.
Write a program that determines the maximum number of knights that can be placed on the chessboard in such a way that none of them can check each other.
Constraints
Input Specification
The first line of input contains two space-separated integers and , where is the chessboard size and is the number of removed fields.
Each of the following lines contains two space-separated integers and — the coordinates of the removed fields. The coordinates of the upper left corner of the board are , and of the bottom right are . The removed fields are not repeated in the input.
Output Specification
Output the maximum number of knights that can be placed on the given chessboard without checking each other.
Sample Input
3 2
1 1
3 3
Sample Output
5
Comments