Score : $600$ points
There is a grid with $H$ rows and $W$ columns. Let $(r, c)$ denote the square at the $r$-th row from the top and $c$-th column from the left.
We have $N$ pieces. For the $i$-th piece, we can choose to do one of the following:
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?
Input is given from Standard Input in the following format:
$H$ $W$ $N$ $A_1$ $B_1$ $C_1$ $D_1$ $A_2$ $B_2$ $C_2$ $D_2$ $\vdots$ $A_N$ $B_N$ $C_N$ $D_N$
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 $(1, 1)$, the second piece at $(2, 2)$, 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 $2$.
5 5 3 1 1 5 5 1 1 4 4 2 2 3 3
3