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
Bojan Rosko:
20150206 14:01:38
could someone post what is test case #0, i'm getting wrong answer, can't figure out why...


sai krishna:
20150126 11:57:01
Segment tree did it 

swordfish12:
20150120 20:59:13
@rishab agarwal, use segment trees 

rishabh aggarwal:
20150105 21:13:44
tle...


j1k7_7(JaskamalKainth):
20141219 07:14:04
Just one change from GSS1. :) 

Rahul:
20141203 13:35:35
Great problem for learning segment trees. :) 

mayank:
20141112 15:44:33
This test case might help.


Mostafa 36a2:
20140903 18:06:56
@EB :I think there should be a statement says: "1<=x<=N" and y in the second query is "1<=y<=N" . 

Mostafa 36a2:
20140829 19:36:43
@The Bear : You have to find any subrange that is the maximum


Disha Garg:
20140815 14:52:23
Last edit: 20140815 15:07:44 
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 