Skip to main content

Practice · 2 of 3

Path Assign, Path Max

CHALLENGE
Difficulty: advanced+25 XP

**Bài toán.** Same input protocol; operations: "1 u v x" — add x to every vertex on the path u..v; "3 u v x" — assign x to every vertex on the path u..v; "2 u v" — print the MAXIMUM value on the path u..v, one per line. **Constraints:** 1 ≤ n, q ≤ 200 000; |val|, |x| ≤ 10^9. Three-tag lazy tree over HLD positions. A pending add that survives an assign is the classic bug this challenge is built to catch.

Back to lesson: Practice: HLD Trio