UVa 871

From Algorithmist

Jump to: navigation, search

Contents

[edit] 871 - Counting Cells in a Blob

[edit] Summary

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

[edit] Instruction

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.

[edit] Optimization

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

[edit] Gotcha's

Multiple input problem. Beware!

[edit] Input

2

11000
01100
00101
10001
01011

010101
101010
010101
101010
010101
101010

[edit] Output

5

18
Personal tools