#Lutece1598. 加帕里公园的friends

加帕里公园的friends

Migrated from Lutece 1598 加帕里公园的friends

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

我还有很多话想和她说,还有很多地方想和她去,把KabanKaban酱还给我!——SabaruSabaru

薮猫酱为了从天蓝怪手里拯救小包,必须发现天蓝怪们的弱点所在。
具体来说,nn只天蓝怪组成了一个序列AA,每一只有一个战斗力数值AiA_i
之后会发生mm个事件,事件共有两种类型,有可能是
11、薮猫酱给你一个区间[a,b][a,b],要你输出 $\max \{A_p+A_{p+1}+{\ldots}+A_q\}\ (a\leq p \leq q \leq b)$
22、第pospos只天蓝怪的战斗力变成了XX

Input

第一行是两个整数nnmm
第二行包含nn个整数A1,A2,,AnA_1,A_2,{\ldots},A_n
接下来mm行,每行三个整数,可能是
1  a  b1\;a\;b,代表薮猫酱的一次询问;
2  pos  X2\;pos\;X,代表某只天蓝怪战斗力的变化。

Output

对于每次询问,单独输出一行,代表答案。

Samples

5 3
1 2 -3 4 5
1 2 3
2 2 -1
1 2 3
2
-1

Note

1n5000001{\leq}n{\leq}500000
1m1000001{\leq}m{\leq}100000
1000Ai1000-1000{\leq}A_i{\leq}1000
1abn1{\leq}a{\leq}b{\leq}n
1posn1{\leq}pos{\leq}n
1000X1000-1000{\leq}X{\leq}1000

Resources

17暑假前集训-数据结构专题 By AutSky_JadeK,思路非原创 - Vijos 1083