variation of range sum query

Правка en2, от bastard123, 2020-08-23 12:21:24
  1. Consider N boxes numbered 1 to N. Each box can house any number of chocolates. And initially all the boxes are empty.

  2. There are two types of queries that can be posed by the throwers.

    a. 0 l r -> Add chocolates to the boxes between the index l and r (inclusive) such that l'th box get 1 chocolate, (l+1)the box gets 2 chocolates ... r'th box gets (r-l+1) chocolate(s)

    b. 1 l r -> Count the number of chocolates that are currently in the boxes between l and r (inclusive)

Can anyone provide some hints?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский bastard123 2020-08-23 12:21:24 6
en1 Английский bastard123 2020-08-23 12:20:00 549 Initial revision (published)