Practice · 3 of 5
Range GCD
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 (1 ≤ x ≤ 10^9);
- 2 l r — in gcd(a_l..a_r).
**Ràng buộc:** 1 ≤ n, q ≤ 100 000.
gcd là phép hợp có phần tử trung tính 0: gcd(0, x) = x.
Press Submit to check your solution.
Back to lesson: Practice: Segment Tree Problem Set