Range update, minimum query - MarisaOJ: Marisa Online Judge

Range update, minimum query

Time limit: 1000 ms
Memory limit: 256 MB
You are given an array $A$ of $n$ integers. There are $q$ queries of either form: - `1 l r x`: Add $x$ to $A_l, A_{l + 1},...,A_r$. - `2 l r`: Find the minimum value in subarray $A_l,A_{l+1},...,A_r$. ### Input - The first line contains 2 integers $n, q$. - The second line contains $n$ integers $A_i$. - The next $q$ lines, each line contains either 3 (for type $2$) or 4 (for type $1$) integers, a query. ### Output - Print the answer for each query of type $2$. ### Constraints - $1 \le n,q \le 10^5$. - $1 \le i \le n$. - $1 \le l \le r \le n$. - $0 \le |A_i|, |x| \le 10^6$. ### Example Input: ``` 5 3 1 2 3 3 2 2 2 4 1 1 4 2 2 3 5 ``` Output: ``` 2 2 ```