← All problemsSign in

Sweet Rectangles

CodeChefRating 3388Open on judge ↗

Chef recently finished a birthday cake, which can be represented by a grid with $N$ rows (numbered $1$ through $N$) and $M$ columns (numbered $1$ through $M$). For each valid $i$, Chef placed a candle with height $a_{i,j}$ in the cell in row $i$ and column $j$. A rectangle with the top left corner in row $r_1$ and column $c_1$ and the bottom right corner in row $r_2$ and column $c_2$ ($1 \le r_

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start