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

Автор pikkupr, 12 лет назад, По-английски
Hello everyone!! this is my first time trying Lazy updates and i\'m getting incorrect results for problem http://www.spoj.com/problems/HORRIBLE/ .
output of test cases through my code:
80
408
though correct output is
80
508

here is my code : http://ideone.com/Yb0ZVO

thanks a lot!
  • Проголосовать: нравится
  • -17
  • Проголосовать: не нравится

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

Is this link broken ?? http://ideone.com/Yb0ZVO

»
12 лет назад, скрыть # |
← Rev. 3  
Проголосовать: нравится +6 Проголосовать: не нравится

line 78-81 in update function

if(rj<=mid)
    return update(l,i,mid,ri,rj,v);
if(ri>mid)
    return update(l+1,mid+1,j,ri,rj,v);

deleted,

write

if(j<ri || i>rj)
     return segtree[t].sum;

my english cant enough for explain

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