Range Minimum Query

3.2

22 votes
Very-Easy
Problem

Given an array A of size N, there are two types of queries on this array.

  1. \(q l r\): In this query you need to print the minimum in the sub-array \(A[l : r]\).
  2. \(u x y\): In this query you need to update \(A[x] = y\).

Input:
First line of the test case contains two integers, N and Q, size of array A and number of queries.
Second line contains N space separated integers, elements of A.
Next Q lines contain one of the two queries.

Output:
For each type 1 query, print the minimum element in the sub-array \(A[l : r]\).

Contraints:
\(1 \le N, Q, y \le 10^5\)
\(1 \le l, r, x \le N\)

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?