Assigning a value on a range using lazy propagation

Revision en1, by 21August, 2019-08-02 12:17:18

Hi everyone. Can somebody provide an working code of a segment tree that supports following operations:

  1. Subtract value on suffix of array.
  2. 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.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English 21August 2019-08-02 12:17:18 803 Initial revision (published)