← All problemsSign in

Greg and Grid

CodeChefRating 1519Open on judge ↗

Recently, Greg got a grid with $n$ rows and $m$ columns. Rows are indexed from $1$ to $n$ and columns are indexed from $1$ to $m$. The cell $ ( i , j )$ is the cell of intersection of row $i$ and column $j$. Each cell has a number written on it. The number written on cell $( i , j )$ is equal to $(i+j)$. Now, Greg wants to select some cells from the grid, such that for every pair of selecte

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