← All problemsSign in

Island Hopping

CodeChefRating 3266Open on judge ↗

The nation of Islandia can be represented as an $N \times N$ grid. Let $(i, j)$ denote the square at the $i$-th row from the top and the $j$-th column from the left. A cell $(i, j)$ is labelled $1$ if it is land and $0$ if it is water. Any two cells of the grid which share a side, and are both land are said to belong to the same island. Islandia holds two contests a year, the first at $(x_a, y_a

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