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 i-th 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
akashbhalotia:
2019-05-17 17:44:58
Works for Java.
|
|
gabrijel:
2019-03-27 23:35:24
Solved with segment tree and with buckets! Both times AC in 2 goes! |
|
gabrijel:
2019-03-27 22:46:04
Bin Jin is a genious! Great problem, great name, great solution... |
|
fabijanb:
2019-03-27 21:47:56
WOOOW, never seen anything like this before, RECOMMEND!!!! |
|
linkret:
2019-03-27 16:11:43
such wonderful task thank you very much dear problemsetter :3 |
|
sir_akshat:
2019-03-20 18:14:03
AC in one go |
|
lamia2658:
2018-11-08 21:31:43
int wa, long long ac.. after doing gss1 ;) |
|
mwx36mwx:
2018-11-04 14:40:01
int Accepted! Last edit: 2018-11-04 14:40:30 |
|
nuhash_40:
2018-10-04 01:24:28
Used int WA
|
|
yash0530:
2018-08-18 09:46:16
If there is an error saying source limit is 5000 bytes try uploading the file it worked for me |
Added by: | Bin Jin |
Date: | 2007-08-03 |
Time limit: | 1s |
Source limit: | 5000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: CPP |
Resource: | own problem |