Skip to main content

Checkpoint: Point Set, Prefix Ask

Challenge on lesson: Checkpoint — The Structure the Budget Names

CHALLENGE
Difficulty: advanced+25 XP

**Task.** An array of n ≤ 200000 integers. q ≤ 200000 operations: 1 p x sets a[p] = x; 2 p prints the prefix sum a[1..p]. After all operations, print the XOR of all answers from type-2 operations and their total modulo 1 000 000 007 (folded as "X S" on one line). **Constraints:** 1 ≤ p ≤ n; 0 ≤ a[i], x < 10^6. **Budget check:** n·q naive re-summing is ~4·10^10 — dead. The interleaved update/query pattern names the structure.

Back to lesson: Checkpoint — The Structure the Budget Names