Изменения рейтингов за последние раунды временно удалены. Скоро они будут возвращены. ×

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

Автор vis10326, 12 лет назад, По-английски

Why do we require a 4*n memory for each of the answer array and the flag array in segment tree with lazy propogation.Can not we work with 2*n memory for each of these arrays and also can not we do this thing that instead of using a flag in the parent node for indicating that it's children needs to be updated we set the flag in the children itself indicating that these needs to be updated.

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

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

Please can anyone explain why do we need 4*N memory for segment tree construction ?

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

instead of using a flag in the parent node for indicating that it's children needs to be updated we set the flag in the children itself indicating that these needs to be updated

this is what i do. here is my code to solve HORRIBLE on SPOJ. if u dont understand it, u can post a comment here.

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

ok i have understood that but i have tried to solve a question by this method but it's giving runtime error. can you please help me in this? i am tired of fixing the bug but still not succeded here is the problem link :http://mirror.codeforces.com/problemset/problem/242/E and here is my code:http://mirror.codeforces.com/submissions/vis10326#.i will be greatly thankful to you