luogu#P8172. [CEOI 2021] L-triominoes
[CEOI 2021] L-triominoes
Background
Translated from CEOI 2021 Day 1 T2. L-triominoes.
Problem Description
Given an rectangle, we call each smallest rectangle inside it a cell. Now cells of this rectangle are missing. Determine whether it is possible to completely cover the whole rectangle using tiles of the shape shown below.

We say a rectangle can be covered if and only if all non-missing cells are each covered by exactly one tile, and no tile goes outside the rectangle or covers any missing cell. Of course, the tiles may also be rotated vertically or by .
Input Format
The first line contains three non-negative integers , representing the number of columns, the number of rows, and the number of missing cells.
The next lines each contain two positive integers , describing the coordinates of a missing cell. It is guaranteed that all given cell coordinates are distinct.
Output Format
If it is possible to cover the rectangle exactly, output one line with the string YES. Otherwise, output one line with the string NO.
4 3 3
1 1
1 3
4 3
YES
5 2 4
1 2
2 1
5 1
5 2
NO
2 3 0
YES
Hint
Sample Explanation
For sample 1, the following is a valid tiling:

For sample 2, you can never cover the cell at .

For sample 3, the following is a valid tiling:

Subtasks
All testdata satisfy , , , , and .
| Subtask ID | Score | Constraints |
|---|---|---|
| , , | ||
| , , | ||
| , , | ||
| , , | ||
| , , | ||
| , , |
Translated by ChatGPT 5