Range Updates with Boundary Markers
Apply interval updates through boundary markers and a prefix sweep.
Adult planning suggestion: about 9–12 · Logic & rule checking
- Players
- 2–4; cooperate, then exchange the checker role
- Time
- 15–25 minutes
- Materials
- Paper, pencil and the supplied player sheet; keep the host sheet separate.
Prepare
Lay eight position cards in order and start all values at zero. Prepare a separate eight-slot marker ledger; positions and marker slots are both numbered 1–8.
Follow the rule
To add v to an inclusive interval [l,r], add v at marker l and subtract v at r+1 if that position exists. Accumulate all markers before reconstructing values.
Check each step
Sweep left to right with a running sum. The sum after reading marker i is the final value at position i. Do not apply the right endpoint cancellation at r itself.
Worked example
Apply [2,5]+3 and [4,7]−1. Keep the two operations visible while combining their four boundary changes. Check a result inside the overlap and outside both ranges.
Finish and adapt
Finish when the reconstructed array matches direct cell-by-cell addition. Swap the checker and try an interval ending at 8; its cancellation is outside the eight returned positions.
Purpose, observation and provenance
Within this activity: Apply interval updates through boundary markers and a prefix sweep.
Ask the checker to name a particular rule and show the recorded evidence. Speed alone is not the goal.
Our rules, examples and printable diagrams are separately prepared. The earliest inventor of the broader mechanism is not established here.
USACO Guide · Difference Arrays — Mechanism background only. Our small paper instance and role rotation are separate; no endorsement or unique-solution claim.
Secondary practice: Cooperation and explaining a check.
For a class of 30, use ten groups of three. Prepare one player-material set per group and keep the host key with the adult. Rotate operator, recorder and checker after each worked example; a reader or scribe may help without choosing answers. Avoid public ranking or diagnostic labels.
Age bands are planning suggestions. Background references may address older learners and do not validate suitability for this age band. Goals describe observable actions, not measured long-term gains or institutional endorsement.
Free alternative: Copy the supplied grids, labels and cards onto reused paper. No specialist product is needed. Adults may prepare pieces or act as a scribe.
Printable materials
Preview at 100% scale, with browser headers and footers off. Cut with suitable help. Keep host keys separate. This is a manual tabletop kit, not an online opponent, automatic judge or solver.
Range Updates with Boundary Markers · Player materials
Lay eight position cards in order and start all values at zero. Prepare a separate eight-slot marker ledger; positions and marker slots are both numbered 1–8.
To add v to an inclusive interval [l,r], add v at marker l and subtract v at r+1 if that position exists. Accumulate all markers before reconstructing values.
Sweep left to right with a running sum. The sum after reading marker i is the final value at position i. Do not apply the right endpoint cancellation at r itself.
| Operation / 操作 | Left / 左 | Right inclusive / 右含 | Value / 值 |
|---|---|---|---|
| I | 2 | 5 | 3 |
| II | 4 | 7 | -1 |
| Step / cell | Decision / value | Rule checked |
|---|---|---|
| ________ | ________ | ________ |
| ________ | ________ | ________ |
| ________ | ________ | ________ |
| ________ | ________ | ________ |
Range Updates with Boundary Markers · Host key — keep separate
Markers 0,3,0,−1,0,−3,0,1. Prefix sweep gives 0,3,3,2,2,−1,−1,0. Direct addition matches at all eight positions.
Lead and check
Lay eight position cards in order and start all values at zero. Prepare a separate eight-slot marker ledger; positions and marker slots are both numbered 1–8.
To add v to an inclusive interval [l,r], add v at marker l and subtract v at r+1 if that position exists. Accumulate all markers before reconstructing values.
Sweep left to right with a running sum. The sum after reading marker i is the final value at position i. Do not apply the right endpoint cancellation at r itself.
Apply [2,5]+3 and [4,7]−1. Keep the two operations visible while combining their four boundary changes. Check a result inside the overlap and outside both ranges.
Finish when the reconstructed array matches direct cell-by-cell addition. Swap the checker and try an interval ending at 8; its cancellation is outside the eight returned positions.
Classroom: ten trios for 30 learners; one kit per trio. Rotate operator, recorder and checker. Age guidance is a planning suggestion; prerequisite support may be necessary.