Hi everyone. Can somebody provide an working code of a segment tree that supports following operations:
- Subtract value on suffix of array.
- Assign a range with the smallest element in that range.
It is guaranteed that the array is always sorted in ascending order after each operation. I would like a code that implements this using lazy propagation. I tried to write such a code for the problem Jousting tournament . Here is a code of the segment tree. Also i have a function "kth" that find the last occurrence of a value in the array. The functions "up" , "push", "build" are used for this part of the problem. Please help to debug or give me another code.