need help in spoj problem

Can someone help me with this [problem][1] on spoj. I have done this problem using lazy propagation and was trying to implement less efficient simple point update for range. Can someone tell me the problem with my


[2]
Even the sample test case is not passing :(.


  [1]: http://www.spoj.com/problems/HORRIBLE/
  [2]: https://ideone.com/bQcxj5

but why is my approach giving wrong answer for sample test case.
I am using the same approach as mentioned in hackerearth link text

@pavitra_ag

This should solve the problem.

1 Like

does this mean that both gfg and hackerearth gave wrong code for updation of range by modifying update function (without lazy propagation)
gfg link https://www.geeksforgeeks.org/lazy-propagation-in-segment-tree/

look before lazy propagation in above link
Help me this confusion is troublesome.

Yes if standalone, no if you supplement it with lazy propagation. They are using the previous update function to explain that the update operations are being stalled and will resume once lazy propagation stops being lazy :smiley:

1 Like

gotcha thanks