Statistics

Problem Statement for "Diamonds"

Problem Statement

Given a rectangular grid consisting of the characters '#' and '.', find two non-overlapping diamond shapes among the '#' characters such that the sum of their radii is maximized. There is a diamond with radius r centered at xC, yC if all characters at position x, y (where |x - xC| + |y - yC| + 1 <= r) in the grid are '#'. The left grid below contains a diamond with radius 3. All the '#' characters in the grid are part of this diamond. The right grid contains a diamond with radius 2. It is centered at (2, 1) and contains five '#' characters (coordinates are zero-based).

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

Create a class Diamonds that contains the method maxRadiusSum that takes a String[] grid and returns an int, the maximum sum of the radii of two non-overlapping diamonds.

Definition

Class:
Diamonds
Method:
maxRadiusSum
Parameters:
String[]
Returns:
int
Method signature:
int maxRadiusSum(String[] grid)
(be sure your method is public)

Notes

  • A diamond can have radius 0. See example 4.

Constraints

  • grid will contain between 1 and 50 elements, inclusive.
  • Each element in grid will contain between 1 and 50 characters, inclusive.
  • All elements in grid will contain the same number of characters.
  • Each character in the elements in grid will be either a '#' or a '.'.

Examples

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

    Returns: 3

    Here we have one diamond with radius 3. We can either pick that diamond and an empty diamond, or a diamond with radius 2 (there are 5 of them) and another with radius 1 (a single '#'). In both cases, we end up with a sum of 3. Note that all radius 2 diamonds overlap with each other.

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

    Returns: 4

    This is the grid from the previous example with one extra '#'. We should now choose the diamond with radius 3 and use the extra '#' as our second diamond (radius 1).

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

    Returns: 6

    The largest diamond has radius 4, but we should instead take two diamonds of radius 3 to get the maximum sum.

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

    Returns: 14

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

    Returns: 34

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

    Returns: 14

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

    Returns: 10

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

    Returns: 18

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

    Returns: 7

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

    Returns: 14

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

    Returns: 20

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

    Returns: 25

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

    Returns: 10

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

    Returns: 24

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

    Returns: 26

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

    Returns: 30

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

    Returns: 31

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

    Returns: 34

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

    Returns: 2

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

    Returns: 2

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

    Returns: 2

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

    Returns: 20

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

    Returns: 5

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

    Returns: 34

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

    Returns: 34

  26. {"..###.#......#######.#####..###.#####..##.#..###..","#.#######..#####################.###############..",".################################################.",".#################################################","##################################################","#################################################.","#################################################.","#################################################.","##################################################","##################################################","#################################################.","##################################################","##################################################","##################################################","#################################################.",".################################################.","##################################################",".#################################################","##################################################","##################################################","##################################################",".#################################################",".################################################.",".#################################################","##################################################","#################################################.",".################################################.",".################################################.","##################################################","##################################################",".#################################################","#################################################.","##################################################",".################################################.","##################################################","##################################################","##################################################",".################################################.","##################################################",".#################################################","##################################################","##################################################","#################################################.",".#################################################",".#################################################",".################################################.","#.################################################","##################################################","###########################################..####.",".#####.#..#.################.###..#.######..#.###."}

    Returns: 34

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

    Returns: 34

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

    Returns: 34

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

    Returns: 34

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

    Returns: 34

  31. {"#.#####.#.##.#.###############.########.#########.",".###############################################.#",".#################################################","##################################################","##################################################","##################################################","#################################################.","##################################################","##################################################","##################################################","##################################################","#################################################.","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","#################################################.","##################################################","##################################################","##################################################",".#################################################","##################################################","##################################################","##################################################","##################################################","##################################################",".#################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","#################################################.","##################################################","###############################################.##",".####.########.######.######.#############.###.###"}

    Returns: 34

  32. {".####..#########.###############.#.##..##.##.#.",".##############################################","###############################################",".#############################################.","..##########################################.##","#############################################..","##############################################.","###############################################",".##############################################","###############################################","###############################################","###############################################",".#############################################.","###############################################","###############################################",".##############################################","###############################################",".##############################################","###############################################","###############################################","###############################################",".##############################################","###############################################","###############################################","###############################################","###############################################","###############################################","###############################################","###############################################","###############################################","###############################################",".##############################################","###############################################","##############################################.","###############################################","###############################################","###############################################","##############################################.",".##############################################",".##############################################","###############################################","###############################################","###############################################","###############################################",".##############################################",".##############################################",".#############################################.","############################################.#.","..#############################################",".#.###.##.###############################..#.#."}

    Returns: 33

  33. {"..###########.###########################.###..",".############################################.#","###############################################","###############################################",".##############################################","###############################################","###############################################","###############################################","###############################################","###############################################","###############################################",".##############################################","###############################################","###############################################","###############################################","##############################################.","###############################################","###############################################","###############################################",".##############################################","###############################################","###############################################","###############################################","###############################################","##############################################.","###############################################",".##############################################","###############################################","###############################################","###############################################","###############################################","###############################################","###############################################","###############################################","###############################################","##############################################.","###############################################",".##############################################","###############################################","###############################################","###############################################","###############################################","###############################################","###############################################",".##############################################","###############################################",".##############################################","##############################################.","#############################################.#",".###########.############################.####."}

    Returns: 33

  34. {"...#################.####.######.####.######.##..#","..###############################################.","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","#################################################.","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","#################################################.","##################################################","##################################################","#################################################.","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","##################################################","#################################################.",".###############################################.#",".#################################.##########.#..."}

    Returns: 34

  35. {"####.##.#.#.#..#############.##.#####.#####..###..","##################################################","#################################################.","################################################.#","###############################################.#.","################################################.#",".#################################################","##################################################","##################################################","##################################################","#################################################.","##################################################","##################################################","##################################################","##################################################","#################################################.","##################################################","##################################################","##################################################",".#################################################","##################################################","##################################################","##################################################",".#################################################","#################################################.","##################################################","##################################################","##################################################",".################################################.","#################################################.",".################################################.","##################################################","##################################################","#################################################.",".#################################################",".################################################.","##################################################","##################################################","#################################################.","##################################################",".#################################################","#################################################.","##################################################",".#################################################","##################################################","##################################################","##################################################","#################################################.","..##.##...###.##########.#########.#############.."}

    Returns: 34

  36. {"########.####################.##################.#","####.########..###########################.#######","###.#############################################.","####.################################.#######..###","####################################.#############","#######################.##############..##########","#######.####.#############################.#######","#####################.#####.##############..######","#####.################.###########################","########.#.######.################.#######.#######","###.###################.############.##########..#","#########.##.#####################################","############################################.#####","#######################################.##########","#######################.#########.######.##.######",".#########..########.#############################","###########.###############################.######","#############################.########.###########","##############################.###################","###############..#.######.########################","########################.######################.##","################################.######.####.#####","########.###############################.#########","##############.########################.########.#","###.#########.##################.##.###########.##","################.###########################.#####",".###.###.###########.#############################","########.#####.########.#########.################","########.##################.#######.##############","########.##########################.########.###.#","#########.#############.#.########################","#######.###################.###############.######","####.####################################.########","##################################################","##.#####.##################################.######","############.#########.####.################.#####","###########.######....###.#######.################","###.####.########.###########.##.#################","###########.####################################.#","##############.########.##############.###..######","################.#.#############.#################","######.########.##################################","#####################.############.###############","##################################.###############","#####################################.############","#######################################.##########","#.##########.####.################.###.###########","##################.#######.####.#.################","##################.####.######################.###","..###############.####.###########################"}

    Returns: 12

  37. {"##################.#######.################.#","##############.#######.##########.###########",".####.##############################.########","##############.#####.##.#####################","#############.##########.################.###","#######.##.####..############.###############","################################.########.###","####################.########################","##.###.##.#####.#############################","###################.#.#######################","#############################################","################.#############.#######..#####","####################..###########..##########",".##############.#############################","############.###################.###.########","########.###.####.##########################.",".#.###############################.##########",".####.############################.######.###","############################.################","##.########..#.##########.###################","###.#######..################################","####.########################################","####################.####.##.########.#######","###.#.##########.##.#########################",".#########.##.#######################.###.###","#####.#######################################","#####.#########.#####################.###..##","#################################.###########","###########.################.################","###.########.################################","########################.#####.###.#.########","#####.################.######################","#######.#####################################","##.##########################.#.#####.#######","##########.################.#################",".################.###################..####..","############################.################","##################.########################.#","##############..################..#.#########","#########.#########.#########################","############.################################","################.############################","##.##########################################","######.#################.###########.##.#####","###############..############################","#############################################","###########.#################################","#############################################","##.#############.###.########################","########.#######.####.#######.###############"}

    Returns: 12

  38. {".#######.#####.##########.####","###.##############.#########.#","#############.################","##########.#.###############.#","#######.#####.#######.###.####","#################.############","#..##.#.################.#####","#####..#######################","#############.######..##.####.","#########.#.###############.##",".##.##########.#.####..#######","###############.##############",".####.#.###.###############.##","##########################.###","#############.#########.######",".##############.#######.######","#############..###############","####.#####.#########.#########","#.##########.############.####","###################.##########","################.#############","####.###################.#####","########.#############..######",".###.################..#.####.","#####################.#####..#","########.###.##.#########.####","###.##.####.##################","##########.##.################","###########################.##","####.#######################.#","###########.######.###########","#########.#########.#########.","########.###########.#####.#.#","#######.######.##########.####","###################.#####.####","##########.#.################.","###########.#####.#######..###","####.#####.##.########.##..###","##########.##########.#.###..#",".####.####.###.###############","#########.#####...############","########################.#####","#############....#############","########...#.#####.###.#.#####","#########...###.##.##.########"}

    Returns: 10

  39. {".##.##..###.#.#######.####.##.####################","######.#####.#..#.#..###############.#.####...####",".#.###.############.###.#######.########.#########","##.##########.##.##########.#####.#.#.###.##.#####","##.############.###.######.#.#####.#..###########.","####.#################.##.#####.########.###.#.##.","#.#######.###.##..###.##############.#.#.##..#####","#############.#.#####.###.#.#############.########","###.##.##.#.############.################.#####.##",".#.######.########.#########.###########.####.#.##","#######..#####..#####..##..#####.##.####.#########","######.##.#.#.##..####.######.#.#.####...#.#######","#########.####.##.########.###..#########.#..###.#","#.#.#.####.####.##########..#.###..##.###.##.##.##","########.##.##################.#######.###########","######...#.##########...#####.#.###.####..#..#.##.","#################################.#########..#.##.","##.####################.#..##.#####.############.#","###.#.########################################.#.#","#######.#.##.####.#########.##.####..#.###########","#.#.##.###########.#############.#######.#########",".############.####.#########.############..######.","###...##.######.########.######.######.#######..##",".#.#########.#.##########.##########.##########.##","###.##.##.############.###.########.#.####.#####.#","##.##############.#########.##.#############..####","########.#####.#.#######.#.############.###.######","..########.##########.#########.#################.","###########..######.#############.#.###.#..#######","#######..###..###.######.##.#..####.#.###.#..####.","#############.###.#######.##.#..################.#",".#######################.#.##########.##.####..###","########.############.#####.####.###..####.#######","####.#.###.#.####.#########################.######","#####..#####..######.###########.#.##.##..#.##.###","####.#################.##.#.####.##.##############","###.######.#.#############################.###.###","######.#.###########.############.#########.#.####","#######.#############.##.#######.#################","#############.##.###...#############.#.##...#####.","###.########.##################.#####.###.########","############.###.######..##########.######.#######","###################.#.###.#.###..#################","##.##.#####.#.######.###.##.##.########.###.######","###.#.#############.#########.###.###.##.#.##.####","######.##.########################################","########.##########.######.#######.#########.####.","##.####.############.###################.####.###.","###.##.###.###.##########..#.###################.#","#############..###.########..#######.##.##########"}

    Returns: 8

  40. {"###.####.#############.##########.################","##############.###############.###..###########.#.","###.#############################.#######.########","###########################################.######","##################.##.############################","###########.########.############.###.############","#.#############.##################################","##############################################.##.","###############.###########.#.################..##",".#######.###########.######################.######",".############.###############.##########.#########","#########.########################################","################################.#.#.########.####","################.##.#########.####################","##.#####.#####################.#.#################","##################################.###############","##################################################","####.#####################################.#####.#","#########################..##############.####.###","###.##################.######################.####","###########.#############.########################","##.######################.########################","##################.########.##.#######.#######.###","##.##.################################.####.#.####","###.##.#########################.#######.#########","#####.###.####.#.#####.###.#####.#############.###","########.####.#.###############################.##","#########.##########.###########################..","######.######..###################################","#.###############################.##.#########.##.","##################################################","#############.##################.#################","..#############.################.#################","#.#.##############################################","#######################.##########################","#########.#.#####.##.#####.########.#.###########.","##########.#########################.#.###########","###.##########################.#.#####.########.##","#######.##.###..########################.#########","####################.#########.###################","########################################.#.#######","###.################.#############################","#########################.########################","######.##################.###################.####","##########################################.####.##","##########################################.#######","####.#################.####.######################","####################.##########.####.###.#########","#############.####################.##########.#.#.","########################.#########################"}

    Returns: 13

  41. {"##..#.##........#...#.##.....#....##.#..#..#..##..","#..##.............#...#..##...#.#.#.##..#......##.","..#..#.#......#..#......#....#.#..##.#.....#......",".#....##...##.......#....#..#...##.#..#..........#",".........###.............#......#.........##.#.##.",".......##.....#..#.#...#..##.......#...#....#.###.","#...###.....###.#..#..#.#.#.......#....#.....##...",".......#.#...................#.#.#......##...#...#","........#.#.#.......#.....#..#.......#...####...#.","..........##...##..#..##.....#..#.....#.....#.....",".##.##....###..#.#........#.....#........#..#.#...","......##.###...#...#..#...#...#.#.#..#.......##..#","##...#.#..................#..##.....#..#.#....#...","#.#....#.......##.......###.##..#...#...#........#","...##..##.....#..#....##...#.....#.......#..#.#...","..#..#..##...##..#..##.##........#..#.#.###....#..","...............#..#..#.....#.#........##.....#..#.","..............#..............#..#........#...#...#","#.#.#.#.....#.##..##.#.#...........#....#.##.#....","....##......#.......................##....#...#.#.","......##.##.##......#.....##........##..##....#...","...........#..#...##....##.##.......#..#....#....#","......#....#.....#.##..#......#...#....##...####..","##.#..#......#...#...#..##.#..#.#...#.#..##.#.....","..........#..#..#.....#..#....#..#.##...##.......#","....##.##....#.......#.......#...#..#......#......",".......#.##..##............#.#........##..#.......","......###.....#........####.......................",".....#..........###....#...#..#..#..#....#......#.","#............#...#...#..##...##........#....#..#..","..##.#........##...#.......###...#...#...#..#....#","....#...#...........#..#.###.#...#.........#...##.","........#......##...#.#...#...................###.",".......#.......#.....#......#.....#..##.#..#....#.","#..#....#....#.#....#.....#.......#.##...#..##.##.","...#.#....##..##...#...#......................#.#.","..#....##........#...#..##.#.#..#......#..........","....#...##.#.....#.#...#..#..#..#.#.......#....#..","...#....#.#.#.###..#.......#...#.#..#....#.#......","##.##....#.....#.....#.....####...................","....#......#.......#......#........#......##......","#.##..#..#........#....#..#.##.#..#...#...#.#.##..",".#.........#.##........#...........###.#.....#...#",".##.........#..#.#..##....###.##.#...##...#......#","..#....#..#.......#........#...........#...#...#..","#.....#...##.#.#.##.#..............#.#.###.#....##","#.#.#.##.............##..###.#.......#..###.#.....",".#......#...##..#.#.##....#...........#......#.#..","...#.#.........##.....##..............#.#.#...#...","..............#.#............##.#.#......#....#.#."}

    Returns: 3

  42. {".##......#.#.#....................#.#........#....","......###..#...#......#...#..............##..#....","...............#...........#......##....#.#.......","....................................#....###......","............................#.....................","..#.......#...........................#......#....","..........#.....#........#.##.....#.#.#..#.......#","...#..##.#......#.......##...#.................##.","..#...............##....#.#...#..................#",".................#..#........#..#..#..............","...##.........#......#...#..........##.....##..#..","...#...#...#.....#...........#..#...#..#.#.......#","...............#......#......#.#...#.#..#.........",".......#...............#...#.........#...#..#.....","..##.........#............#...#.......#....#......","#.......#...................................##..#.","....#.......#......#........#.#....#.......#.....#","#..##....#.........#.###...........#...........###","#....#......#..........##.#........#............##","..#......#.#...#.........#.............#....##...#","...#........#.#......#....#.....#.................",".....##........##..##....##....#..................","...#........##....#..##..#........##......#.......",".........................#.....#.......#..#.......","........#.......#......#...##.................#.#.","..#.............##.............#..................",".................#....#.......##.#...#....#.......","...#..#............#..........#....#....#.....#...","...##....#...........#........#.#.#....##.#.......","...........##.#.......#.#.##.#.................#..","...#.......#..#..#.#.#.....#.............###....##","#..#.#.#...#...........#...................##.....","..................................................","###.#..#.......#.#...##...#.#....#............#.#.","....#.#.............#..........#...#...#......###.",".....##.....#.#.##...............#.#.....#...#....",".....#.....#.......#.....#....#..#................",".....#.....#.....................#..#.....#.......","..........#...#.......#.#.....#.....##.........#..","..#...#...........#.#......###...........#....#...","......#.......#........#...............##...#...#.","...........#....##.........................#......",".#..#.........#.##..#............#................","....#...#.##..........#........#.....#......##...#","......#.............#...#.......#......##.#....#..","........#.......#....#.#.#.......#.#.#.....#......","##.....#..#...........#.....#......#.#..#.#...##..","..#.....#........#.....#.........#.....#....#.#.#.","..........#.#..#....#.......#..#...............##.","...#..........................#..................."}

    Returns: 2

  43. {"#..#.#...##.....##.....#..#....##..#..#.#....#....","..#...###....#..#.......#....#..............#...#.",".......#.............................####.........",".#......#.#....#....#....#...##.....#.#........#..","............##.#.....#......#...#......#.#.....#..","..........##.#......#............#................","..#..#......#.#.......#...........##..#.#..#......",".#..#........#......#.#.......#.....#...#...#.##..","##.#.......#.#..#...............##..........#.#...","....#...#.....#.#....#.#..#.##..........#...#.#...","..#....#.........#.....#.##..#..#.#....#.......#.#",".....####..........#.#...#...........###......##..","......#......#.#........#........#...#......####..",".............#......#....#....#.........#.#.#....#",".#................#.....#....##...#.....#...#.....","......#.##...#.......##.#.#.............##........",".#.#.#.#.#.#..#................#..#.....###.#...#.",".#.......#.....#.........#......................#.","...#.#.......#........#..#.....#...........#......",".......##..#........#..#....#..#.##..#.#..#.#.#...","...###...........###...#......#.......#.#........#",".#..#.........#.##..#.....####......#...##........","..##....##..#........#.#...#......#....#........##","#............####.....###.#....#..#.##..........#.",".#.....##.#........#.#.....#.#.#..#..#.#..#.......",".................#.#..........#.........#.....###.",".#.....#........###..........###.......#.###.##...","...............#.#...#..............#....#.....##.","..##...#.........##...#..#....#.#...............#.",".#.###.....#.##.............##...........#........","..#..##...#.##.##.#.....##.......#...###..........",".....#.##.#..................#..#.##...##........#","#.........#..................#.....#...#..#.....#.","#..#.........#......#.#....#..##..#.........#...##","......##..........#.##.#.##.#.#...........#......#",".......#..#..#.#.....##........##.....#.##........","..#....##....#.........##..##..#.........#..#...#.","...#...##..........#..#..#......#........#.#.....#","...........#...#............#.....##............#.",".........###..#.#...#.........##.......#...#......","..#...#..#.......#..#....#..#....#.#.##.##...#...#",".#......................#....#......#......#......","........#..##.#.#..#..##....##.....#..#.#....#....","#....#.#....##............#.#.#....#.#...#...#....","#...#.....#.#.#...##..#...........#..........###..",".#..........#..#......##...#.....#....##.#....##.#",".###...##.........#.....#.........#....#....#.....","....#...#........#.......#.....##.#.....#.#......#",".....#......#..#.#.......#..##......##....#......#",".........#......#...#...##...#.........#.#.....#.."}

    Returns: 3

  44. {"......................#...........................",".....................###.......................#..","....................#####..................#......","...................#######................###.....","..........#.......#########................#......",".........###.......#######........................","........#####.......#####.........................",".......#######.......###..........................","......#########.......#...........................",".....###########.........................#........","....#############.......................###.......","...###############.....................#####......","..#################...................#######.....","...###############...................#########....","....#############...................###########...",".....###########...................#############..","......#########...................###############.",".......#######.....................#############..","........#####.......................###########...",".........###.........................#########....","..........#...........................#######.....",".......................................#####......","........................................###.......",".........................................#........","..................................................","..................................................","..................................................","..................................................",".............................#....................","............................###...................","...........................#####..................","..........................#######.................",".........................#########................","..........................#######.................",".....#.....................#####..................","....###.....................###...................",".....#.......................#....................","..................................................","..................................................","..................................................","..................................................","..................................................","..................................................","..................................................","..................................................","..................................................","..................................................","..................................................","..................................................",".................................................."}

    Returns: 17

  45. {"..................................................","..................................................","..................................................","..................................................","..................................................","..................................................","..................................................","..................................................","..................................................","..................................................","..................................................",".............................#....................",".#................................................","###...............................................",".#................................................","..................................................","..................................................","..................................................","..................................................","..................................................","..................................................","................................................#.","............#.....................................","...........###....................................","..........#####...................................",".........#######..................................","........#########.................................",".......###########................................","......#############...............................",".....###############...#..........................","....#################.###.........................","...#######################........................","..#######################.........................",".#########################........................","###########################.......................",".###########################......................","#.###########################...#.................","...###########################.###................","....###############################...............",".....###############################..............","......################################............",".......###########.###################............",".......##########...#################.............","......##########.....###############..............",".....##########.......#####..######...............","....##########.........###....####................",".....#####..#...........#.......#.................","......###..###..............................#.....",".......#....#.....................................",".................................................."}

    Returns: 19

  46. {"..................................................","..#.............#.................................",".###..............................................","..#...............................................","................#.................................","...............###................................","................#.................................",".............................#....................","............................###.....#.............","....................#......#####..................","...................###....#######.................","..................#####..#########................",".................##################...............","................####################..............","...............######################.............","..............########################............",".............##########################...........","............##########################............","...........##########################.............","..........##########################..............",".........##########################...............","........##########################................",".......###########################................","......#############################...............",".....###############################..............","....#################################.............","...###################################............","..#####################################...........",".#######################################..........","#########################################.........",".#######################################..........","..#####################################...........","...###################################............","....#################################.............",".....###############################..............","......#############################...............",".......###########################................","........#########################.................",".........#######################..................","..........#####################...................","...........###################....................","............#################.....................",".............###############......................","..............#############.......................","...............###########........................","................#########.........................",".................#######..........................","..................#####...........................","...................###............................","....................#............................."}

    Returns: 27

  47. {"..................................................","..............#...................................",".............###..................................","............#####.................................","...........#######................................","..........#########...............................",".........###########..............................","..........#########...............................","...........#######.......................#........","............#####.......................###.......",".............###.......................#####......","..............#.........................###.......",".........................................#........","..................................................","..................................................","..................................................","..................................................","....................................#.............","......................#............###............",".....................###..........#####...........","....................#####........#######..........","...................#######......#########.........","..................#########......#######..........",".................###########......#####...........","................#############......###............","...............###############......#.............","..............#################...................",".............###################..................","............#####################.................","...........#######################.........#......","............#####################.........###.....",".............###################.........#####....","..............#################.........#######...","...............###############.........#########..","................#############.........###########.",".................###########.........#############","..................#########...........###########.","...................#######.............#########..","....................#####...............#######...",".....................###.................#####....","......................#...................###.....","...........................................#......","..................................................","..................................................","..................................................","..................................................","..................................................","..................................................","..................................................",".................................................."}

    Returns: 19

  48. {".#"}

    Returns: 1

  49. {"."}

    Returns: 0

  50. {"##################################################" }

    Returns: 2

  51. {"#" }

    Returns: 1

  52. {".....", "...#.", "..###", "..##.", ".###.", "..#.." }

    Returns: 4

  53. {"##" }

    Returns: 2

  54. {"." }

    Returns: 0

  55. {"##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################" }

    Returns: 34

  56. {"...######", "...######", "...######" }

    Returns: 4

  57. {".#################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "##################################################", "#################################################." }

    Returns: 34

  58. {".", ".", "#", ".", "." }

    Returns: 1


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: