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
vikrant:
20140730 09:27:02
@Bin Jin what does #0 mean? 

Anirudh Rayabharam:
20140720 15:24:20
This is complete nonsense. Why is the source limit so low? The standard is 50000 Bytes. 

Mike OBeirne:
20140522 05:40:50
For Java, I had to use a faster scanner (using BufferedInputReader), as well as using StringBuilder for the output. Was able to finally get it to pass, though! 

The Bear:
20140428 16:58:47
Can anyone please explain why the test case for 1 2 4 is equal to 4 and not 3? Is this an incorrect test case? 

Zhao Xinyi:
20140314 08:37:18
what does "wrong answer #0" mean? 

hiddenman:
20140209 20:09:21
enjy a lot in doing this question .....


harsh:
20140115 14:24:50
0.21 sec..\m/.. 

The Wizard:
20130917 01:32:20
I think in this problem using segment tree is so useful 

nishchay:
20130901 06:09:57
AC :D


!!.Nginx.!!:
20130516 13:42:07
how query: 1 2 4 giving output=4 shouldn't it be 3 (2+(3)+4) 
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 