#P5611. [Ynoi2013] D2T2
[Ynoi2013] D2T2
Problem Description
Given a sequence of length , there are query operations.
Each query is in the form . It means: keep the positions whose values are in unchanged, and set all other positions to . Then, compute the maximum subarray sum within the interval of the resulting sequence. This subarray is allowed to be empty.
Input Format
The first line contains two integers .
The second line contains integers representing the sequence.
Then follow lines, each containing four integers , representing one query operation.
Output Format
Output lines, each containing one integer representing the answer.
6 5
-1 1 -4 5 -1 4
1 1 4 5
1 1 4 514
2 3 3 3
1 6 -1 5
2 5 2 5
0
0
0
9
5
Hint
Idea: nzhtl1477, Solution: ccz181078, Code: ccz181078, Data: nzhtl1477.
Constraints: for of the testdata, , and the absolute value of every number in the sequence is .
In the fourth group of queries, the value range limit is , and the sequence becomes -1 1 0 5 -1 4. The maximum subarray in interval is , with sum .
In the fifth group of queries, the value range limit is , and the sequence becomes 0 0 0 5 0 4. The maximum subarray in interval is (tied), with sum .
Translated by ChatGPT 5