How to do a range update in Binary Indexed Tree or Fenwick Tree?

后端 未结 2 2194
礼貌的吻别
礼貌的吻别 2021-02-15 12:55

I am trying to solve this problem in UVA with Binary Indexed Tree:

Problem H
Ahoy, Pirates!

Input: Standard Input
Output: Standard Output


In the ancient pirate         


        
2条回答
  •  耶瑟儿~
    2021-02-15 13:18

    A BIT can be operated in one of 3 modes:

    • Point updates and range queries
    • Range updates and point queries
    • Range updates and range queries

    I've explained range updates with BIT and provided implementation here: http://kartikkukreja.wordpress.com/2013/12/02/range-updates-with-bit-fenwick-tree/

提交回复
热议问题