TC LandAndSea


 * http://www.topcoder.com/stat?c=problem_statement&pm=7512

Summary
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

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