You are not logged in. Please login at to post your questions!


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.

asked 02 Jun '18, 21:24

arpit728's gravatar image

accept rate: 10%

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


answered 03 Jun '18, 00:31

pavitra_ag's gravatar image

accept rate: 5%


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

(03 Jun '18, 10:41) arpit7281★

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

(03 Jun '18, 15:40) l_returns5★


People have passed this question through segment tree.

(03 Jun '18, 16:29) arpit7281★

okay then u must me missing something..

(03 Jun '18, 17:24) l_returns5★

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

(03 Jun '18, 17:26) l_returns5★

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


answered 03 Jun '18, 11:57

sudip_95's gravatar image

accept rate: 10%

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 02 Jun '18, 21:24

question was seen: 187 times

last updated: 03 Jun '18, 17:26