Given an array
- Find the maximum prefix sum of the subarray from index
to index . That is, find the maximum sum of a subarray starting at and ending in the range . - Update the element at index
to value .
Constraints
Input Specification
The first line contains
The second line contains
The next
P l r
representing the first operation.U i x
representing the second operation.
Output Specification
For each type
Sample Input
Copy
7 5
-1 3 2 -6 5 -6 7
P 2 6
P 5 7
U 4 -3
P 2 6
P 1 1
Sample Output
Copy
5
6
7
-1
Comments