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



I am getting TLE in MULTQ3.

Here is my code, please help.

I have used segment trees with lazy propagation. I have also used fast I/O, still I am getting TLE.

Please Help, I am stuck from very long time.

asked 11 Dec '14, 19:56

the65bit's gravatar image

accept rate: 13%

the time limit is a tad too strict ;-) . In your code,I shortened the length of the tree from 8x10^6 to 3x10^5, made the tree from static to global, and removed the tree as a parameter from all the functions, and the same code gets AC
Here's the AC submission:
try to avoid allocating extra space, and adding unnecessary parameters to functions wherever possible :)
I appreciate you in writing such a clean and precise code.. really helped in debugging


answered 13 Dec '14, 03:00

gvaibhav21's gravatar image

accept rate: 25%

edited 13 Dec '14, 13:02

Thank you very much, I was stuck in many problems of lazy propagation and was on the verge on convincing myself that my implementation of lazy update is wrong.You have helped me very much.Thank you once again @gvaibhav21.

(14 Dec '14, 20:57) the65bit4★

you're welcome :)

(14 Dec '14, 22:52) gvaibhav217★

Getting TLE. Used lazy propagation. Is there any problem with my implementation of lazy ?

Code :


answered 04 Jun '15, 16:12

monera's gravatar image

accept rate: 0%

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: 11 Dec '14, 19:56

question was seen: 1,620 times

last updated: 04 Jun '15, 16:12