← CSES Better

Sum Range-Max Operation Scores over Subarrays

ZIO · 2026 · Zonal Informatics Olympiad · P4

Open official problem ↗
Ask AI

Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.

Open Claude Desktop

arrays · range-operations · subarrays

The organizer’s problem statement is available at the official source link.

range overlays

Build a profile with interval maximum overlays

An operation sets each value in [L,R] to at least v; score each array by the fewest operations, then sum scores over subarrays.

Problem grid; highlighted cells show the illustrated path
L->R
vvv
C[i] = max(C[i], v)
  1. 1

    View interval layers

    View each operation as a horizontal interval layer at height v.
  2. 2

    Rebuild each subarray

    Layers combine pointwise by maximum to form the target subarray.
  3. 3

    Sum minimum operation counts

    Find the minimum layer count per subarray and sum all scores.
Tools
1
2
3
4
5
6
7
8
9
10
11
12
Draft saved locally
|12 lines, 156 chars

Run output

Run your code to see output.