Блог пользователя Ahnaf.Shahriar.Asif

Автор Ahnaf.Shahriar.Asif, история, 7 лет назад, По-английски

Hello everybody , please help me , i was solving problems in light oj , "curious Robin Hood" and getting wrong answer. problem link : http://lightoj.com/volume_showproblem.php?problem=1112

code link : https://paste.ubuntu.com/25753376/

i am a beginner and i recently learned a bit about segment tree , i used segment tree in this solution , but i can't find my faults , can anyone please help me ?

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

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

line 74 & 75 seems problematic. You are printing from original array. but change is not stored in original array. it stored in the tree.

after printing the value it must be removed from the tree. you are subtracting x from tree. should x be the right value??

think about it.