Range Update - Range Max Queries

3.8

4 votes
Very-Easy
Problem

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

  1. qlr: In this query you need to print the minimum in the sub-array A[l:r].
  2. uxyz: In this query you need to add z to all the elements from x to y yn=xA[n]=A[n]+z

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:
1N,Q,y,z105
1l,r,xN

Sample Input
5 5
1 5 2 4 3
q 1 5
q 1 3
u 3 5 2
q 3 5
q 1 5
Sample Output
1
1
4
1
Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?