#K16066. Garden Operations
Garden Operations
Garden Operations
You are given a rectangular garden of size \(n \times m\) where every cell is initially empty (i.e., not planted). You need to perform a sequence of operations on the garden. There are three types of operations:
- 1 i j: Plant a seed at position \( (i, j) \). (The cell becomes planted.)
- 2 i j: Remove the plant at position \( (i, j) \). (The cell becomes empty.)
- 3 i j: Check the cell at position \( (i, j) \). If there is a plant, output "Yes"; otherwise, output "No".
Note that the rows and columns are 1-indexed.
You are to process the operations in order and for every check operation (type 3), print the corresponding result on a new line.
inputFormat
The first line contains three integers \(n\), \(m\), and \(q\) representing the number of rows, the number of columns of the garden, and the total number of operations respectively.
Each of the following \(q\) lines contains three integers: op i j
, where op
is the operation type (1, 2, or 3), and \(i\) and \(j\) denote the cell's row and column respectively.
outputFormat
For each query of type 3, output a line containing either "Yes" if the cell is planted or "No" if it is empty.
## sample5 5 7
1 1 1
1 2 2
3 1 1
3 2 2
2 1 1
3 1 1
3 2 2
Yes
Yes
No
Yes
</p>