atcoder#ABC205F. [ABC205F] Grid and Tokens
[ABC205F] Grid and Tokens
Score : points
Problem Statement
There is a grid with rows and columns. Let denote the square at the -th row from the top and -th column from the left.
We have pieces. For the -th piece, we can choose to do one of the following:
- Put it at a square such that and .
- Do not put it on the grid.
However, we cannot put two pieces in the same row or the same column.
At most how many pieces can we put on the grid?
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
2 3 3
1 1 2 2
1 2 2 3
1 1 1 3
2
By putting the first piece at , the second piece at , and not putting the third piece on the grid, we can put two pieces on the grid. We cannot put three, so we should print .
5 5 3
1 1 5 5
1 1 4 4
2 2 3 3
3