#C1707. Matrix Query Processing
Matrix Query Processing
Matrix Query Processing
You are given an integer matrix \( A \) of size \( n \times m \). You will need to process \( q \) queries on this matrix. There are two types of queries:
- Update Query:
1 x y v
— Set \( A_{x,y} = v \). - Fetch Query:
2 x y
— Print the current value of \( A_{x,y} \).
All indices are 1-indexed.
Your task is to process the queries in the given order and output the result for each fetch query.
inputFormat
The input is given via standard input (stdin) in the following format:
n m A[1][1] A[1][2] ... A[1][m] A[2][1] A[2][2] ... A[2][m] ... A[n][1] A[n][2] ... A[n][m] q query_1 query_2 ... query_q
Each query is either in the form:
1 x y v
: Update the element at row \( x \) and column \( y \) to \( v \).2 x y
: Output the element at row \( x \) and column \( y \).
outputFormat
For each fetch query (type 2), output the corresponding element value on a separate line via standard output (stdout).
## sample3 3
1 2 3
4 5 6
7 8 9
4
2 1 1
1 1 1 10
2 1 1
2 3 3
1
10
9
</p>