Practice · 1 of 5
Point Updates, Range Sums
CHALLENGE
Difficulty: intermediate+25 XP
**Bài toán.** Cho dãy a_1..a_n. Xử lý q thao tác:
- 1 i x — gán a_i := x;
- 2 l r — in tổng a_l..a_r.
**Ràng buộc:** 1 ≤ n, q ≤ 200 000; 1 ≤ i ≤ n; 1 ≤ l ≤ r ≤ n; 1 ≤ a_i, x ≤ 10^9.
Tổng mỗi truy vấn có thể tới 2·10^14 — dùng long long.
Press Submit to check your solution.
Back to lesson: Practice: Segment Tree Problem Set