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

×

TLE in MULTQ3

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

4★the65bit
1.1k101328
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: http://www.codechef.com/viewsolution/5577407
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

link

answered 13 Dec '14, 03:00

gvaibhav21's gravatar image

7★gvaibhav21
947210
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 : http://www.codechef.com/viewsolution/7075422

link

answered 04 Jun '15, 16:12

monera's gravatar image

3★monera
1
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×2,320
×1,726
×1,114
×715
×42
×38
×6

question asked: 11 Dec '14, 19:56

question was seen: 1,620 times

last updated: 04 Jun '15, 16:12