GSS3  Can you answer these queries III
You are given a sequence A of N (N <= 50000) integers between 10000 and 10000. On this sequence you have to apply M (M <= 50000) operations:
modify the ith element in the sequence or for given x y print max{Ai + Ai+1 + .. + Aj  x<=i<=j<=y }.
Input
The first line of input contains an integer N. The following line contains N integers, representing the sequence A1..AN.
The third line contains an integer M. The next M lines contain the operations in following form:
0 x y: modify Ax into y (y<=10000).
1 x y: print max{Ai + Ai+1 + .. + Aj  x<=i<=j<=y }.
Output
For each query, print an integer as the problem required.
Example
Input: 4 1 2 3 4 4 1 1 3 0 3 3 1 2 4 1 3 3 Output: 6 4 3
hide comments
jedyn:
20170327 18:07:24
cant pass gss1 in java but works in gss3 : 

scorpion_ajay:
20170324 16:47:34
AC in a go, do GSS1 before this!! 

nilabja16180:
20170302 09:06:57
AC in 3rd Go!


hasan356:
20170116 10:39:04
my 50th 

siddharth_0196:
20161227 16:02:22
GSS1 + update() = GSS3 ! 

shashi_92:
20161106 06:27:05
what is wrong ans #0 please help. 

Anirban Acharya:
20161014 11:59:25
what is wrong answer #1 ? 

davidgalehouse:
20161004 01:46:31
For C# solvers: Input formatted incorrectly, sufficient to use Trim. 

avisheksanvas:
20160804 22:10:06
Do GSS1 before this!


baadshah_:
20160715 16:38:22
AC in one Go same as GSS1 with one update function 
Added by:  Bin Jin 
Date:  20070803 
Time limit:  0.330s 
Source limit:  5000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: CPP 
Resource:  own problem 