How can I quickly identify a particular problem can easily be solved by BIT? What kinds of problems can be solved by BIT other than range sum calculation & increasing sub-sequence?
# | User | Rating |
---|---|---|
1 | tourist | 3993 |
2 | jiangly | 3743 |
3 | orzdevinwang | 3707 |
4 | Radewoosh | 3627 |
5 | jqdai0815 | 3620 |
6 | Benq | 3564 |
7 | Kevin114514 | 3443 |
8 | ksun48 | 3434 |
9 | Rewinding | 3397 |
10 | Um_nik | 3396 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 155 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
10 | nor | 152 |
How can I quickly identify a particular problem can easily be solved by BIT? What kinds of problems can be solved by BIT other than range sum calculation & increasing sub-sequence?
Name |
---|
Well, the fact that you need cumulative sums and you can update some element in array, like you have queries sum(l,r) and update(pos,val)
It's also possible to solve range minimum query (only with negative updates) and range maximum query (only with positive updates) with BIT.
Anyway, BIT is like set or vector ... It's just a useful tool! You can use it when you need it. You just have to keep it in your mind this thing exists and be ready to use it.
See this link , for understanding various usage of BIT.
http://zobayer.blogspot.in/2013/11/various-usage-of-bit.html
For problems, follow this link :-
http://ahmed-aly.com/Category.jsp?ID=26
You can find the number of inversions in permutation using BIT:
So index i is 1 if number i was already visited, otherwise it's 0. With sum(A[i]) we find the numbers less than A[i], which are on its right. If it's not a permutation, just a sequence with N distinct numbers, you can easy compress them from 1 to N in O(NlogN) using STL sort.
M.Mahdi thanks for your concept :) .. I never knew it .. :( hagu zobayer vai's blog is awesome and thanks to you for your information. :) P_Nyagolov thank you :)
I am trying to solve problem.