VoolDD5's blog

By VoolDD5, 10 years ago, In English

hi :)
is it possible make all this operations with BIT?
1- add(l, r, val) >add a[l..r] value of val
2- sum(l, r) >calculate sum of a[l..r]

I thought it is impossible until saw this comment
I didn't understand it correctly :( can anybody explain the approach:)
Tks a lot

Tags bit
  • Vote: I like it
  • +3
  • Vote: I do not like it

»
10 years ago, # |
  Vote: I like it +8 Vote: I do not like it

Yep, as adamant has posted it is possible. However in my opinion its much better to just be comfortable using a segment tree, after a bit of practice they really aren't complicated and don't take very long to write.