#P5073. [Ynoi Easy Round 2015] 世上最幸福的女孩

[Ynoi Easy Round 2015] 世上最幸福的女孩

Description

At the very end, Ctholly gives you a sequence of length nn, with mm operations:

  1. Global add (i.e., add to all numbers in the sequence).
  2. Query the maximum subarray sum in an interval.

Input Format

The first line contains two integers n,mn,m.

The second line contains nn numbers representing the sequence.

Then follow mm lines, each describing one operation.

  • 1 x1\ x : Add xx to all numbers.
  • 2 l r2\ l\ r : Query the maximum subarray sum in the interval [l,r][l,r] (you may choose no elements; in this case the maximum subarray sum is 00).

Output Format

For each query, output one number as the answer.

5 7
-10 -3 -2 -4 -5
2 2 4
1 5
2 2 4
1 3
2 1 5
1 2
2 3 5
0
6
18
19

Hint

Idea: nzhtl1477, Solution: ccz181078, Code: nzhtl1477&w33z8kqrqk8zzzx33, Data: nzhtl1477.

Constraints: 1n3×1051\leq n \leq 3\times 10^5, 1m6×1051 \leq m \leq 6\times 10^5, the absolute value of numbers in the sequence 2×109\leq 2\times 10^9, and the absolute value of xx in operation 11 is 5×107\leq 5\times 10^7.

Translated by ChatGPT 5