← All problemsSign in

Divesh Quenches Thirst

Divesh loves water, and more than that he loves quenching the thirst of others with water. Today he is on a mission to quench the thirst of people in the city. The city is in the form of an $N \times M$ grid denoted by $A_{N \times M}$. Furthermore, the city is divided into _regions_. Each cell in the grid has an ID denoted by $A_{i, j}$. Each cell can have at most $8$ neighbouring cells (Top Left

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