10290: CF EDU - Segment Tree P2 - Step 3 - A. Assignment and Maximal Segment
[Creator : ]
Description
There is an array of $n$ elements, initially filled with zeros. You need to write a data structure that processes two types of queries:
- assign value $v$ to all elements on the segment from $l$ to $r−1$,
- find the segment with maximal sum.
Input
The first line contains two numbers $n,m\ (1≤n,m≤100,000)$, the size of the array and the number of operations.
The following lines contain the desc
The desc
Output
Print $m$ lines: the maximum sum of numbers on a segment after each operation. Please note that this segment may be empty (so the sum on it will be equal to 0).
Sample 1 Input
5 3
0 5 3
1 3 -1
3 4 -5
Sample 1 Output
15
7
3