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. \(q \; l \; r\): In this query you need to print the minimum in the sub-array \(A[l : r]\).
  2. \(u \; x \; y \; z\): In this query you need to add z to all the elements from x to y \(\sum_{n=x}^{y} A[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:
\(1 \le N, Q, y, z \le 10^5\)
\(1 \le l, r, x \le N\)

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

?