← All problemsSign in

Heap Pirates

For a binary matrix with $R$ rows and $C$ columns (each cell in a binary matrix contains either $0$ or $1$), we define the *associated graph* of this matrix as follows: - each $8$-connected component of cells containing the same value corresponds to one node of the graph - for each pair of adjacent $8$-connected components, there is an edge between their corresponding nodes A cell in 8-connected

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