Problem Brief
Board Coloring and Query Processing
OA
Consider a rectangular h × w board with all cells initially white. You are to process several queries of the following types:
For each query, except the ones of the first type, find the answer.
For each query except the ones of the first type, store the answer's coordinates in the array. If the desired cell doesn't exist, store [-1, -1] instead. The answers should be stored in the same order as the queries.
1Example 1
Input
h = 3, w = 5, queries = ["v 1 2", "x 2 2", "v 1 2", "> 2 1", "x 2 3", "> 2 1", "< 2 0"]
Output
[[2, 2], [-1, -1], [2, 3], [2, 4], [-1, -1]]
Explanation
:3
Constraints
Limits and guarantees your solution can rely on.
1 ≤ h ≤ 500.1 ≤ w ≤ 500.5 ≤ queries.length ≤ 10^4 (OR MAYBE 104).