Masala #GBQ6AU7GPS

Xotira 32 MB Vaqt 1000 ms Qiyinchiligi 1 %
14

  

Tarjima qilib ishlang!

Given an array of n integers, your task is to process q queries of the following types:

  1. update the value at position k to u
  2. what is the sum of values in range [a,b]?

Kiruvchi ma'lumotlar:
  • The first input line has two integers n and q: the number of values and queries.
  • The second line has n integers x[1], x[2]​, …, x[n]​: the array values.
  • Finally, there are qqq lines describing the queries. Each line has three integers: either "1 k u" or "2 a b".

 

1 ≤ n, q ≤ 2⋅10^5

1 ≤ x[i], u ≤ 10^9

1 ≤ k ≤ n

1 ≤ a ≤ b ≤ n


Chiquvchi ma'lumotlar:

Print the result of each query of type 2.


Misollar
# input.txt output.txt
1
8 4
3 2 4 5 1 1 5 3
2 1 4
2 5 6
1 3 1
2 1 4
14
2
11
Yechimini yuborish
Bu amalni bajarish uchun tizimga kiring, agar profilingiz bo'lmasa istalgan payt ro'yxatdan o'tishingiz mumkin