Getting TLE in basic lazy propagation problem - UPDATEIT from SPOJ

I am getting TLE in UPDATEIT can anyone help to figure out what is wrong my code. Here is the link.

You don’t require segment tree or lazy propagation for such problem . It can be solved using prefix sum. Here is my


[1] :)


  [1]: https://ideone.com/aMbZsD

@pavitra_ag

I am learning lazy propagation that is the reason for doing it this way.

I don’t code in JAVA, so not sure you’ve used the Fastest I/O, but there’s lots of comments there that without the fastest I/O, you will get TLE

using wrong algo would take more time and hence maybe its TLE…

@l_returns

People have passed this question through segment tree.

okay then u must me missing something…

r u sure they did it in java ? cuz java is slow :frowning: