Skip to main content

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.

Back to lesson: Practice: Segment Tree Problem Set