segment-tree2: how to deal with both plus and muiltiply operate of segments?
when you need to search down a node,you should erase the “lazy” tag and update the subnodes(pushdown).in the past,the operate is only plus. it may be like this:
so if you don’t want to search down,you can remenber “a+b+c+d” as an “lazy” tag.
but now,muiltiply operate has added.so,it may be like this:
so,it’s time to expand the “lazy” tag.
so,how to update the tag? it’s esay when k or b is 0. in other cases,we should use some math formulas.
just simply merge “b”.
of course,using “distributibe law of muiltiply”,we should muiltiply both “k” and “b”.
here are the code:
锟斤拷 !@#$qwer 烫烫烫