#C1887. Process Array Queries
Process Array Queries
Process Array Queries
You are given a number of test cases. For each test case, you are provided with an array of integers and a set of queries. There are two types of queries:
- Update Query: Given as ( (1, X, V) ), update the element at the ( X^{th} ) position in the array to the new value ( V ).
- Minimum Query: Given as ( (2, L, R) ), output the minimum value in the subarray range ( [L, R] ) (inclusive).
Your task is to process all the queries in the order they appear and output the result for each minimum query.
Note: The indices in the queries are 1-indexed. The input and output should be handled through standard input and standard output respectively.
inputFormat
The input begins with an integer ( T ) indicating the number of test cases. For each test case:
- The first line contains two integers ( N ) and ( Q ), where ( N ) is the number of elements in the array and ( Q ) is the number of queries.
- The second line contains ( N ) space-separated integers representing the array elements.
- The next ( Q ) lines each contain three integers representing a query. Each query is of the form:
- ( 1\ X\ V ): Update the array element at index ( X ) to ( V ).
- ( 2\ L\ R ): Find the minimum element in the subarray from index ( L ) to ( R ) (inclusive).
outputFormat
For each test case, output the result of each query of type 2 (minimum query) on a new line in the order they appear.## sample
1
5 5
1 5 3 7 9
2 1 3
1 3 2
2 1 3
1 5 4
2 4 5
1
1
4
</p>