#C9940. Dossiers Priority Manager

    ID: 54089 Type: Default 1000ms 256MiB

Dossiers Priority Manager

Dossiers Priority Manager

In this problem, you are given an array of integers representing the priority levels of dossiers. You will then be given a series of operations to perform on this array. The operations are as follows:

  1. Increment Operation: Increase all elements in the index range [l,r][l, r] by a value xx.
  2. Decrement Operation: Decrease all elements in the index range [l,r][l, r] by a value xx.
  3. Query Operation: Output the maximum value in the index range [l,r][l, r].

Note that the array is 1-indexed. You are required to process the queries in order and output the result of each query operation (type 3) on a separate line.

The input is read from standard input (stdin) and the results should be printed to standard output (stdout).

inputFormat

The first line contains two integers nn and qq, representing the number of dossiers and the number of operations, respectively. The second line contains nn space-separated integers, representing the initial priority levels of the dossiers. The next qq lines each describe an operation in one of the following formats:

  • For the increment operation: 1 l r x
  • For the decrement operation: 2 l r x
  • For the query operation: 3 l r

Here, ll and rr (with 1lrn1 \leq l \leq r \leq n) denote the start and end indices of the range (inclusive), and xx is the value to add or subtract.

outputFormat

For each query operation (operation type 3), output a single line containing the maximum dossier priority in the specified range.## sample

10 5
5 3 8 1 6 4 9 2 7 5
1 3 7 2
2 2 5 1
3 1 7
1 6 10 5
3 6 10
11

16

</p>