Practice · 1 of 5
Stamp Collector
CHALLENGE
Difficulty: beginner+25 XP
**Description:** A strip of n positions starts at 0. Apply q updates: add v to every
position in [l, r]. Print the final value of every position.
**Input:** Line 1: n q (1 <= n, q <= 2*10^5). Next q lines: l r v (1 <= l <= r <= n,
-10^9 <= v <= 10^9).
**Output:** n integers — the final values, space-separated.
**Example:** 5 2 / 2 4 5 / 1 3 -2 -> -2 3 3 5 0.
Press Submit to check your solution.
Back to lesson: Practice: Difference Array Problem Set