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

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

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

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

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

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.