Practice: Prefix sums
0 of 4 solved
About these problems
Apply, Connect, Reason and Stretch describe difficulty within this topic, not an official contest rating. Open any problem in any order; reading the chapter first is optional.
- 1Range totalsAnswer q range-sum queries on an unchanged array. Each query gives inclusive, 1-based positions l and r.ApplyNot started
- 2Best fixed blockAmong all consecutive blocks of exactly k elements, print the largest sum. Values may be negative.ConnectNot started
- 3Range paint countsAn initially zero array has n positions. Each of q instructions adds integer v to every position in inclusive range l..r. After all instructions, print the final array.ReasonNot started
- 4Rectangle sensorsA grid contains 0 or 1 in each cell. Answer queries counting 1s in an inclusive rectangle with top-left(r1, c1) and bottom-right(r2, c2).StretchNot started