TC LandAndSea

From Algorithmist
Jump to navigation Jump to search

Summary[edit]

A tricky (but not too inherently difficult) grid problem. You're given a rectangular map with each cell either water or land. An island is any connected component of the 8-neighbour map. You need to determine something about how the islands "contain" each other.

From TopCoder Single Round Match 341.

Hints[edit]

  • Finding the "level" of each island is similar to the "Longest Paths" problem UVa_10000.
  • You will also need to use flood fill.