Practice · 3 of 5
Sensor Readings
CHALLENGE
Difficulty: intermediate+25 XP
**Description:** A sensor array of n cells starts at 0. First apply q updates
(add v to every cell in [l, r]), then answer p point queries: the final value
of cell x.
**Input:** Line 1: n q p (1 <= n <= 10^6, 1 <= q, p <= 2*10^5). Next q lines:
l r v. Next p lines: x (1 <= x <= n).
**Output:** p lines — the final value of each queried cell.
**Example:** 5 2 3 / 1 4 3 / 3 5 -1 / 1 / 3 / 5 -> 3 / 2 / -1.
Press Submit to check your solution.
Back to lesson: Practice: Difference Array Problem Set