#C9940. Dossiers Priority Manager
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:
- Increment Operation: Increase all elements in the index range by a value .
- Decrement Operation: Decrease all elements in the index range by a value .
- Query Operation: Output the maximum value in the index range .
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 and , representing the number of dossiers and the number of operations, respectively. The second line contains space-separated integers, representing the initial priority levels of the dossiers. The next 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, and (with ) denote the start and end indices of the range (inclusive), and 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>