UVa 871

From Algorithmist
Jump to: navigation, search

871 - Counting Cells in a Blob[edit]

Summary[edit]

Search all area in the given map using floodfill method. Then calculate the area for each found blob. Output the maximum one.

Instruction[edit]

Search all area in the given map using floodfill method. Then calculate the area for each found blob. Output the maximum one. Since the map only 25x25 size, use array for better approaching.

Optimization[edit]

Using iterative floodfill method can increase the speed of your program and make your program more save from stack overflow.

Gotcha's[edit]

Multiple input problem. Beware!

Input[edit]

2

11000
01100
00101
10001
01011

010101
101010
010101
101010
010101
101010

Output[edit]

5

18