{"problem":{"name":"Grid and Tokens","description":{"content":"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","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc205_f"},"statements":[{"statement_type":"Markdown","content":"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.\nWe have $N$ pieces. For the $i$\\-th piece, we can choose to do one of the following:\n\n*   Put it at a square $(r, c)$ such that $A_i \\leq r \\leq C_i$ and $B_i \\leq c \\leq D_i$.\n*   Do not put it on the grid.\n\nHowever, we cannot put two pieces in the same row or the same column.\nAt most how many pieces can we put on the grid?\n\n## Constraints\n\n*   $1 \\leq H, W, N \\leq 100$\n*   $1 \\leq A_i \\leq C_i \\leq H$\n*   $1 \\leq B_i \\leq D_i \\leq W$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$H$ $W$ $N$\n$A_1$ $B_1$ $C_1$ $D_1$\n$A_2$ $B_2$ $C_2$ $D_2$\n$\\vdots$\n$A_N$ $B_N$ $C_N$ $D_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc205_f","tags":[],"sample_group":[["2 3 3\n1 1 2 2\n1 2 2 3\n1 1 1 3","2\n\nBy 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\n1 1 5 5\n1 1 4 4\n2 2 3 3","3"]],"created_at":"2026-03-03 11:01:14"}}