lazy-propagation

Using lazy propagation for queries of more than 2 types

不羁的心 提交于 2019-12-08 05:40:35
问题 I have a question with a lot of queries which are of four types: Add to range. Initialize a range. Multiply a range with scalar. Find running sum over a range. Since queries are in huge numbers I have to use segment tree with lazy propagation but I am stuck on how to use lazy propagation on more than 2 types of queries. How would I be able to identify that when updates are to be made later, then what type of update(i.e. addition, multiplication, initializing) is to be made? 回答1: You could