Statistics

Problem Statement for "PlusSign"

Problem Statement

You are given a String[] pixels that describes a rectangular bitmap. Each character in pixels represents one pixel of the bitmap: '#' is a black pixel and '.' is a white one.
A plus sign is a collection of black pixels that looks as follows:
  • The smallest bounding box of the collection of pixels is a square with an odd side length.
  • All pixels inside that bounding box are black (i.e., belong to the plus sign), except for four identical squares of white pixels - one in each corner of the bounding box.
  • The white squares must have a positive side length.
  • The side of the bounding box must be strictly greater than twice the side of each of the white squares.
Your task is to change the given rectangular bitmap into a bitmap on which all black pixels form a plus sign. To do this, you can only paint white pixels into black, but not in the other direction. (I.e., each of the pixels that are black in pixels has to remain black.)
Return the smallest number of pixels you have to paint black, or -1 if forming a plus sign is impossible.

Definition

Class:
PlusSign
Method:
draw
Parameters:
String[]
Returns:
int
Method signature:
int draw(String[] pixels)
(be sure your method is public)

Constraints

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

Examples

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

    Returns: 1

    It is sufficient to paint the pixel surrounded by the black pixels black to get a 3x3 plus sign with 1x1 cutouts in the corners.

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

    Returns: 31

    The smallest plus that can include these two black pixels is 7x7 with 2x2 cutouts in the corners, which requires painting 31 pixels black.

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

    Returns: -1

    No valid plus sign that would fit into this grid can include the given black pixel.

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

    Returns: 0

    Don't need to paint any pixels.

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

    Returns: -1

    Only a plus of even width is possible

  6. {"."}

    Returns: -1

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

    Returns: -1

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

    Returns: 5

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

    Returns: 5

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

    Returns: 4

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

    Returns: 3

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

    Returns: -1

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

    Returns: 2

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

    Returns: -1

    Max # of black pixels with impossible answer

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

    Returns: -1

    Still impossible (even width plus)

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

    Returns: 0

    Max # of black pixels with possible plus

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

    Returns: 62

    Max possible plus with some cells missing

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

    Returns: 2395

    Largest possible plus defined by 2 pixels (= max answer)

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

    Returns: 95

    49x49 plus of width 1 (97 black cells total) defined by cells on adjacent arms

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

    Returns: 283

    49x49 plus of width 3 (285 black cells total)

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

    Returns: 95

    49x49 plus of width 1 (97 black cells total) defined by cells on opposite arms

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

    Returns: 463

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

    Returns: -1

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

    Returns: -1

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

    Returns: -1

    To catch off-by-one errors when checking whether the plus fits in the grid

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

    Returns: -1

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

    Returns: -1

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

    Returns: -1

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

    Returns: 7

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

    Returns: 97

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

    Returns: 34

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

    Returns: 27

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

    Returns: 53

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

    Returns: 68

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

    Returns: 138

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

    Returns: 37

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

    Returns: 490

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

    Returns: 30

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

    Returns: 275

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

    Returns: 56

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

    Returns: 11

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

    Returns: 82

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

    Returns: 84

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

    Returns: 24

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

    Returns: 5

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

    Returns: 37

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

    Returns: 160

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

    Returns: 15

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

    Returns: 611

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

    Returns: 60

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

    Returns: 28

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

    Returns: 29

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

    Returns: 36

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

    Returns: 20

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

    Returns: 7

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

    Returns: 33

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

    Returns: -1

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

    Returns: -1

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

    Returns: -1

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

    Returns: -1

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

    Returns: -1

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

    Returns: -1

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

    Returns: -1

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

    Returns: -1

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

    Returns: -1

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

    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: