#K50832. Array Processor

    ID: 28952 Type: Default 1000ms 256MiB

Array Processor

Array Processor

You are given an array of integers and you need to process a series of queries. There are two types of queries:

  • update i x: Update the value at position \(i\) (1-indexed) to \(x\).
  • min l r: Query the minimum value in the subarray from index \(l\) to \(r\) (inclusive). In mathematical notation, you are required to compute $$\min_{l \leq j \leq r} a_j$$.

The queries are given via standard input. Your task is to implement the query processing such that for each min query, the correct minimum is returned based on the current state of the array. For update queries, simply modify the array for subsequent queries.

inputFormat

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.

Each of the following \(q\) lines contains a query in one of the following formats:

  • min l r
  • update i x

Note: The array is 1-indexed.

outputFormat

For each query of type min, output the minimum value in the corresponding subarray on its own line.

## sample
5 5
4 3 2 1 5
min 1 3
min 1 4
min 4 5
update 3 6
min 1 3
2

1 1 3

</p>