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
Yes. http://petr-mitrichev.blogspot.ru/2013/05/fenwick-tree-range-updates.html
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.