#P10937. 車的放置
車的放置
Problem Description
Given a chessboard with rows and columns, it is known that some cells are forbidden to place pieces on.
Find the maximum number of rooks that can be placed on the board such that no two rooks can attack each other.
Each rook is placed in a cell, and its attack range is the same as the Chinese chess piece “車”.
Input Format
The first line contains three integers , where is the number of forbidden cells.
The next lines each contain two integers and , indicating that the cell at row and column is forbidden. Rows and columns are numbered starting from .
It is guaranteed that all forbidden cells are distinct.
Output Format
Output one integer, which is the answer.
8 8 0
8
Hint
Constraints: .
Translated by ChatGPT 5