Given an array of n elements. Initially all of them are zero. We need to process three type of queries:
- assign value vto all elements on the segment fromltor,
- add vto all elements on the segment fromltor,
- find the sum on the segment from ltor.
We can solve this problem by doing some simple loops. But the problem is there are as much as 100000 queries of these three types. So, this method will take much time. That's why I tried using segment tree and lazy propagation to solve this problem, but couldn't solve it. How to solve this problem?
This problem is from here.
