Statistics

Problem Statement for "IslandInALake"

Problem Statement

You are given the String[] country that contains a rectangular map of a region. The map is divided into cells, and each cell is either water ('.') or land ('#'). All cells on the border of the map are water cells.

Boats can travel between water cells by moving in the four cardinal directions ("up, down, left, right"). Two water cells belong to the same body of water if a boat can reach one of those cells from the other (without going onto land). The body of water that contains the border of the map is the sea, all other bodies of water are lakes.

Rabbits can travel between land cells by moving in eight directions (not just horizontally and vertically, but also diagonally). Two land cells belong to the same island if a rabbit can reach one of those cells from the other (without going into water).

You have just inherited an unlimited amount of soil. You want to use it to build your own island somewhere in this region. You really dislike saltwater, so you want to build your island on one of the lakes (and not in the sea). Obviously, your island must be a single island (as defined above) and it must not touch any of the existing islands.

Compute and return the largest possible number of cells that can form your new island-in-a-lake. Return 0 if it's not possible to build a new island in a lake.

Definition

Class:
IslandInALake
Method:
build
Parameters:
String[]
Returns:
int
Method signature:
int build(String[] country)
(be sure your method is public)

Constraints

  • country will contain between 1 and 50 elements, inclusive.
  • Each element of country will contain between 1 and 50 characters.
  • All elements of country will contain the same number of characters.
  • Each character in country will be either '.' or '#'.
  • Each character on the boundary of country (i.e., first+last row+column) will be '.'.

Examples

  1. {"......", "......", "......", "......", "......"}

    Returns: 0

    Only the sea. No islands, no lakes, nowhere to build our new island-in-a-lake.

  2. {".......", "..##...", ".##..#.", "..#.#..", "......."}

    Returns: 0

    Two islands in the sea. One has five cells, the other one has two. No lakes anywhere.

  3. {".......", ".####..", ".#...#.", ".#####.", "......."}

    Returns: 0

    One island with a lake that consists of three cells. The lake is too narrow, we cannot build any new island inside the lake.

  4. {"..........", ".####.....", ".#...#....", ".#...#....", ".#...#....", ".#####....", ".........."}

    Returns: 1

    This time we can build a single-cell island inside the lake. The new map would then look as follows (with the new island denoted by an asterisk): .......... .####..... .#...#.... .#.*.#.... .#...#.... .#####.... ..........

  5. {"............", ".####.#####.", ".#...#....#.", ".#........#.", ".#...#....#.", ".#########..", "............"}

    Returns: 2

    A bigger island, still with a single lake. There are now multiple ways to build a new island on this lake, including one way of building an island that consists of two adjacent cells. ............ .####.#####. .#...#....#. .#.....**.#. .#...#....#. .#########.. ............

  6. {"...........", "..#####....", "..#....##..", "..#.....#..", "...#.....#.", "..#.#....#.", ".#...#...#.", "..###.###..", "..........."}

    Returns: 3

    This map contains a single island and there are two lakes on this island. One is too small to build on, the other can contain a new island of size 3 as shown below. ........... ..#####.... ..#....##.. ..#..*..#.. ...#..*..#. ..#.#..*.#. .#...#...#. ..###.###.. ...........

  7. {"...........", ".#########.", ".#.......#.", ".#.#####.#.", ".#.#...#.#.", ".#.#...#.#.", ".#.#...#.#.", ".#.#####.#.", ".#.......#.", ".#########.", "..........."}

    Returns: 1

    We can build a 1-cell island in the center of this map. The lake that contains it is actually a lake on an island that is on a lake on an island, but we do not care about that. Any lake (i.e., any body of water other than the sea) can be used for building.

  8. {"...........", ".#########.", ".#.......#.", ".#.#####.#.", ".#.#...#...", ".#.#...#.#.", ".#.#...#.#.", ".#.###.#.#.", ".#.......#.", ".#########.", "..........."}

    Returns: 0

    This map looks similar to the previous one, but this one actually contains two separate islands, and all water is sea so we cannot build our island anywhere.

  9. {"...........", ".#########.", ".#.......#.", ".#.......#.", ".#.......#.", ".#.......#.", ".#.......#.", ".#.......#.", ".#...#...#.", ".#.......#.", ".#.......#.", ".#.......#.", ".#########.", "..........."}

    Returns: 31

    The optimal new island is shown below. Notice how it goes around the existing tiny island. ........... .#########. .#.......#. .#.*****.#. .#.*****.#. .#.*****.#. .#.*****.#. .#.*...*.#. .#.*.#.*.#. .#.*...*.#. .#.*****.#. .#.......#. .#########. ...........

  10. {"..............................", ".############################.", ".#..........................#.", ".#..........................#.", ".#..........................#.", ".########################...#.", "........................#...#.", ".######################.#...#.", ".#....................#.#...#.", ".#....................#.#...#.", ".#....................#.#...#.", ".#...##############...#.#...#.", ".#...#............#...#.#...#.", ".#...#.##########.#...#.#...#.", ".#...#.#........#.#...#.#...#.", ".#...#.#........#.#...#.#...#.", ".#...#.#........#.#...#.#...#.", ".#...#.#...#....#.#...#.#...#.", ".#...#.#...########...#.#...#.", ".#...#.#..............#.#...#.", ".#...#.#..............#.#...#.", ".#...#.#..............#.#...#.", ".#...#.################.#...#.", ".#...#..................#...#.", ".#...####################...#.", ".#..........................#.", ".#..........................#.", ".#..........................#.", ".############################.", ".............................."}

    Returns: 138

  11. {"..............................", "..............................", "..............................", "..............................", "..............................", "..............................", "..............................", "..............................", "..............................", "..............................", "..............................", "..............................", "..............................", "..............................", "..............................", "..............................", "..............................", "..............................", "..............................", "..............................", "..............................", "..............................", "..............................", "..............................", "..............................", "..............................", "..............................", "..............................", "..............................", ".............................."}

    Returns: 0

  12. {"..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", ".................................................."}

    Returns: 0

  13. {"..................................................", ".################################################.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".################################################.", ".................................................."}

    Returns: 1936

  14. {"..................................................", ".################################################.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#....#............##...........................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................#...............#.", ".#..............................#...............#.", ".#..........#...............########............#.", ".#.........#.#...................#..............#.", ".#..........#....................#..............#.", ".#...............................#..............#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#............######............................#.", ".#...........#......#...........................#.", ".#..........#.......#...........................#.", ".#...........#.....#............................#.", ".#............#####.............................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".################################################.", ".................................................."}

    Returns: 1782

  15. {"..................................................", ".################################################.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#....#............##...........................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................#...............#.", ".#..............................#...............#.", ".#..........#...............########............#.", ".#.........#.#...................#..............#.", ".#..........#....................#..............#.", ".#...............................#..............#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#............######............................#.", ".#...........#......#...........................#.", ".#..........#.......#...........................#.", ".#...........#.....#............................#.", ".#............#####.............................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".#####################################.##########.", ".................................................."}

    Returns: 3

  16. {"..................................................", ".################################################.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".################################################.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".################################################.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".################################################.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".################################################.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".################################################.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".################################################.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".################################################.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".################################################.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".################################################.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".################################################.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".################################################.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".################################################.", ".................................................."}

    Returns: 1

  17. {"..................................................", ".################################################.", ".#...#...#...#...#...#...#...#...#...#...#......#.", ".#...#...#...#...#...#...#...#...#...#...#......#.", ".#...#...#...#...#...#...#...#...#...#...#......#.", ".################################################.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".################################################.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".################################....############.", ".#...#...#...#...#...#...#...#.......#...#...#..#.", ".#...#...#...#...#...#...#...#.......#...#...#..#.", ".#...#...#...#...#...#...#...#.......#...#...#..#.", ".################################################.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#.......#...#...#...#...#...#..#.", ".###################...##########################.", ".#...#...#...#...#.......#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#########...####################################.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#########...####################################.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".################################################.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".################################################.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".################################################.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".################################################.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".################################################.", ".................................................."}

    Returns: 10

  18. {"..................................................", ".################################################.", ".#...#...#...#...#...#...#...#...#...#...#......#.", ".#...#...#...#...#...#...#...#...#...#...#......#.", ".#...#...#...#...#...#...#...#...#...#...#......#.", ".################################################.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".################################################.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".################################....############.", ".#...#...#...#...#...#...#...#.......#...#...#..#.", ".#...#...#...#...#...#...#...#.......#...#...#..#.", ".#...#...#...#...#...#...#...#.......#...#...#..#.", ".################################################.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#.......#...#...#...#...#...#..#.", ".###################...#############..........###.", ".#...#...#...#...#.......#...#...#...........#..#.", ".#...#...#...#...#...#...#...#...............#..#.", ".#...#...#...#...#...#...#...#...............#..#.", ".#########...#################........###########.", ".#...#...#...#...#...#...#...........#...#...#..#.", ".#...#...#...#...#...#...............#...#...#..#.", ".#...#...#...#...#...#...........#...#...#...#..#.", ".#########...#########.......####################.", ".#...#...#...#...............#...#...#...#...#..#.", ".#...#...#...#...............#...#...#...#...#..#.", ".#...#...#...#...........#...#...#...#...#...#..#.", ".#############...........########################.", ".#...#...#...#...........#...#...#...#...#...#..#.", ".#...#...#...#...........#...#...#...#...#...#..#.", ".#...#...#...#...........#...#...#...#...#...#..#.", ".###############......###########################.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".################################################.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".################################################.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".#...#...#...#...#...#...#...#...#...#...#...#..#.", ".################################################.", ".................................................."}

    Returns: 114

  19. {"..................................................", ".################################################.", ".#..............................................#.", ".#.############################################.#.", ".#.#..........................................#.#.", ".#.#..........................................#.#.", ".#.#..######################################..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#...##############################...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#....####################....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#.....#######......#....#...#..#.#.", ".#.#..#...#....#.....#.....#......#....#...#..#.#.", ".#.#..#...#....#.....#.....#......#....#...#..#.#.", ".#.#..#...#....#.....#.....#......#....#...#..#.#.", ".#.#..#...#....#.....#######......#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....####################....#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...##############################...#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..######################################..#.#.", ".#.#..........................................#.#.", ".#.#..........................................#.#.", ".#.############################################.#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".################################################.", ".................................................."}

    Returns: 184

  20. {"..................................................", ".################################################.", ".#..............................................#.", ".#.############################################.#.", ".#.#..........................................#.#.", ".#.#..........................................#.#.", ".#.#..######################################..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#...##############################...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............#...............#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#....####################....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#.....#######......#....#...#..#.#.", ".#.#..#...#....#.....#.....#......#....#...#..#.#.", ".#.#..#...#....#.....#.....#......#....#...#..#.#.", ".#.#..#...#....#.....#.....#......#....#...#..#.#.", ".#.#..#...#....#.....#######......#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....####################....#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...##############################...#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..######################################..#.#.", ".#.#..........................................#.#.", ".#.#..........................................#.#.", ".#.############################################.#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".################################################.", ".................................................."}

    Returns: 178

  21. {"..................................................", ".################################################.", ".#..............................................#.", ".#.############################################.#.", ".#.#..........................................#.#.", ".#.#..........................................#.#.", ".#.#..######################################..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#...##############################...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............#...............#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#....####################....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#.....#######......#....#...#..#.#.", ".#.#..#...#....#.....#.....#......#....#...#..#.#.", ".#.#..#...#....#.....#.....#......#....#...#..#.#.", ".#.#..#...#....#.....#.....#......#....#...#..#.#.", ".#.#..#...#....#.....#######......#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....####################....#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............#...............#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...##############################...#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..######################################..#.#.", ".#.#..........................................#.#.", ".#.#..........................................#.#.", ".#.############################################.#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".################################################.", ".................................................."}

    Returns: 161

  22. {"..................................................", ".################################################.", ".#..............................................#.", ".#.############################################.#.", ".#.#..........................................#.#.", ".#.#..........................................#.#.", ".#.#..######################################..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#...##############################...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............#...............#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#....####################....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#........##........#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#.....#######......#....#...#..#.#.", ".#.#..#...#....#.....#.....#......#....#...#..#.#.", ".#.#..#...#....#.....#.....#......#....#...#..#.#.", ".#.#..#...#....#.....#.....#......#....#...#..#.#.", ".#.#..#...#....#.....#######......#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#.............#....#....#...#..#.#.", ".#.#..#...#....#..............#...#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....####################....#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............#...............#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...##############################...#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..######################################..#.#.", ".#.#..........................................#.#.", ".#.#..........................................#.#.", ".#.############################################.#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".################################################.", ".................................................."}

    Returns: 128

  23. {"..................................................", ".################################################.", ".#..............................................#.", ".#.############################################.#.", ".#.#..........................................#.#.", ".#.#..........................................#.#.", ".#.#..######################################..#.#.", ".#.#..#...........#........................#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#...##############################...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............#...............#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#....####################....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#........##........#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#.....#######......#....#...#..#.#.", ".#.#..#...#....#.....#.....#......#....#...#..#.#.", ".#.#..#...#....#.....#.....#......#....#...#..#.#.", ".#.#..#...#....#.....#.....#......#....#...#..#.#.", ".#.#..#...#....#.....#######......#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#.............#....#....#...#..#.#.", ".#.#..#...#....#..............#...#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....####################....#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............#...............#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...##############################...#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..######################################..#.#.", ".#.#..........................................#.#.", ".#.#..........................................#.#.", ".#.############################################.#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".################################################.", ".................................................."}

    Returns: 125

  24. {"..................................................", ".################################################.", ".#..............................................#.", ".#.############################################.#.", ".#.#..........................................#.#.", ".#.#..........................................#.#.", ".#.#..######################################..#.#.", ".#.#..#...........#........................#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#...##############################...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............#...............#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#....####################....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#........##........#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#.....#######......#....#...#..#.#.", ".#.#..#...#....#.....#.....#......#....#...#..#.#.", ".#.#..#...#....#.....#.....#......#....#...#..#.#.", ".#.#..#...#....#.....#.....#......#....#...#..#.#.", ".#.#..#...#....#.....#######......#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#.............#....#....#...#..#.#.", ".#.#..#...#....#..............#...#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....####################....#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............#...............#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...##############################...#..#.#.", ".#.#..#.................................#..#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..######################################..#.#.", ".#.#..........................................#.#.", ".#.#..........................................#.#.", ".#.############################################.#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".################################################.", ".................................................."}

    Returns: 92

  25. {"..................................................", ".#####.##########################################.", ".#..............................................#.", ".#.############################################.#.", ".#.#..........................................#.#.", ".#.#..........................................#.#.", ".#.#..######################################..#.#.", ".#.#..#...........#........................#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#...##############################...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............#...............#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#....###########.########....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#........##........#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#.....#######......#....#...#..#.#.", ".#.#......#....#.....#.....#......#........#..#.#.", ".#.#..#...#....#.....#.....#......#....#...#..#.#.", ".#.#..#...#....#.....#.....#......#....#...#..#.#.", ".#.#..#...#....#.....#######......#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#.............#....#....#...#..#.#.", ".#.#..#...#....#..............#...#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....#..................#....#...#..#.#.", ".#.#..#...#....####################....#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...#............#...............#...#..#.#.", ".#.#..#...#............................#...#..#.#.", ".#.#..#...##############################...#..#.#.", ".#.#..#.................................#..#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..#....................................#..#.#.", ".#.#..######################################..#.#.", ".#.#..........................................#.#.", ".#.#..........................................#.#.", ".#.######.#####################################.#.", ".#..............................................#.", ".#..............................................#.", ".#..............................................#.", ".################################################.", ".................................................."}

    Returns: 3

  26. {"."}

    Returns: 0

  27. {"............", ".####.#####.", ".#...#....#.", ".#........#.", ".#...#....#.", ".#########..", "............" }

    Returns: 2

  28. {"...........", ".#########.", ".#.......#.", ".#.#####.#.", ".#.#...#.#.", ".#.#...#.#.", ".#.#...#.#.", ".#.#####.#.", ".#.......#.", ".#########.", "..........." }

    Returns: 1

  29. {"...................", ".#####.......#####.", ".#####.......#####.", ".#####.......#####.", ".#####.......#####.", ".#####.......#####.", ".#####.......#####.", ".#################.", ".#################.", ".#################.", "..................." }

    Returns: 0

  30. {"...", ".#.", "..." }

    Returns: 0


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: