Problem hidden
GSS9 - Can you answer these queries IX
Consider integer sequence a1, a2, ..., an. You should run queries of two types:
- The query format is "0 i val". In reply to this query you should make the following assignment: ai = val.
- The query format is "1 l r k". In reply to this query you should print the maximum sum of exactly k non-intersecting subsegments of sequence al, al + 1, ..., ar. Formally, you should choose exactly k pairs of integers (x1, y1), (x2, y2), ..., (xt, yt) (l ≤ x1 ≤ y1 < x2 ≤ y2 < ... < xt ≤ yt ≤ r; t ≤ k) such that the sum ax1 + ax1 + 1 + ... + ay1 + ax2 + ax2 + 1 + ... + ay2 + ... + axt + axt + 1 + ... + aytis as large as possible.
Input
Output
Example
Input:2
-1 -1
1
1 1 2 2
Output: -2
Added by: | xiaodao |
Date: | 2013-03-19 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | Own Problem |