Solving SEACO with normal segment tree

How to solve SEACO using normal segment tree?
Thanks!

https://discuss.codechef.com/questions/110979/unofficial-editorial-of-seaco-and-fillmtr-brief
this might help

Keep 2 segment trees, one for the array and one for the query list. Now process the queries in reverse, and get the number of times the current query has to be executed from the query segment tree. If it is of type 1 update the array segment tree otherwise update the query segment tree by that amount.
My solution: link. The code should be easy enough to understand, but ask if you need further help!

1 Like

Please refrain from using editorial or its tag for a question.

1 Like

sorry and thanks as well
actually i didn’t know

It actually then appear as an “Editorial” to that problem. We avoid it so that people dont face inconvenience :slight_smile:

can it be done without using lazy propagation ?

My solution above does not use lazy propagation.