ayushrocker92's blog

By ayushrocker92, 10 years ago, In English

Hi i want to know is it possible to calculative range minimum/maximum query with BIT?

If yes then how??

And is its code shorter than segment tree for RMQ??

please help as it would be easy to write short codes during contest .Thanx :)

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
10 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it
  • »
    »
    10 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    const int N = 1 << 17; // has to be power of 2 — this condition in your code is required only for non-commutative operations. And min is of course commutative. My recent submission with this approach 8125739 — AC.