Amazing problem! I did it after reading the editorial. It took a while; but it really reinforced my understanding of segment trees. You can view my solution here if interested.

I am getting WA

https://www.codechef.com/viewsolution/7492057

I am also getting WA on similar spoj problem http://www.spoj.com/problems/HORRIBLE/

My spoj solution id http://www.spoj.com/submit/HORRIBLE/id=14688264

I am not able to figure out why i am getting WA in both problems. Please help me out?

Can someone tell me what is wrong with my solution.I did as told in the Editorial.

Very nice question to implement lazy propagation

can anybody tell me what’s wrong with my solution?

here is the solution :

[solution][1]

[1]: https://www.codechef.com/viewsolution/14270746

Yes someone please explain