Блог пользователя svg_af

Автор svg_af, история, 10 лет назад, По-английски

Hello There

I'm trying to solve this Problem using a persistent segment tree

I keep getting TLE for reasons i can't find

If anyone would so kindly explain the reason behind the memory leak it would be really appreciated

Here is my code

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
10 лет назад, скрыть # |
Rev. 4  
Проголосовать: нравится +1 Проголосовать: не нравится

query function shouldn't create new nodes. It's horrible.

You have O(N·log2(N)) space complexity with this code.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

You got ML, not TL. You programs eats too much memory. That's exactly because of persistent segment tree, as you save all previous steps and it needs a lot of memory.

»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I am also facing the same issue. Can someone check my code and tell why it is giving MLE.

79459003

»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

This was very nice question ... I did it now .. Great question

Thanks a lot bro