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

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

Can someone please help me with this problem. Here is my solution. It's giving me wrong answer on test 2. I am applying simple lazy prapogation logic. Can someone help me, It will hardly take 5 minutes of your time.

My logic: Firstly I fill the whole segment tree with -1's. Now, query function is simply finding an element present on a particular index and when we have some update pending in the path from root to this node I will simply assign this value to it's children and current node will have value -1 after this. My english is poor, sorry.

Thanks very much.

Upd: Accepted code

Полный текст и комментарии »

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