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 | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
# | 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 | 156 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
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.