Problem Statement
There is a rectangular maze built on a two-dimensional grid. Each cell of the grid is either an empty corridor or a wall. A corridor is denoted by a period ('.'), a wall is denoted by a hashmark ('#'). You are given the
You are also given the
You have to move in steps. In each step you can take one of the following actions:
- Walk to any of the four adjacent cells provided that the target cell is empty. This move takes 1 second.
- Teleport to the nearest empty cell in any of the four cardinal directions. This move takes 2 seconds.
You are not allowed to make a move that would take you outside the maze.
If reaching the destination is impossible, return -1. Otherwise, return the smallest T such that it is possible to go from (r1, c1) to (r2, c2) in T seconds.
Definition
- Class:
- TeleportationMaze
- Method:
- pathLength
- Parameters:
- String[], int, int, int, int
- Returns:
- int
- Method signature:
- int pathLength(String[] a, int r1, int c1, int r2, int c2)
- (be sure your method is public)
Constraints
- a will contain between 1 and 50 elements, inclusive.
- Each element of a will contain between 1 and 50 characters, inclusive.
- All elements of a will have the same length.
- Each character in each element of a will be either '.' or '#'.
- Both r1 and r2 will be between 0 and |a|-1, inclusive.
- Both c1 and c2 will be between 0 and |a[0]|-1, inclusive.
- The origin and the destination will be distinct.
- The origin and the destination will both be empty.
Examples
{".##.", ".###", ".###", "...."}
0
0
3
3
Returns: 4
0##2 .### .### ...4 You begin in the cell labeled 0. The optimal solution is to teleport eastwards (to the cell labeled 2) and from there to teleport southwards (to the cell labeled 4). The above solution takes 4 seconds. For comparison, walking southwards three times and then eastwards three times takes 6 seconds total.
{"#.", ".#"}
0
1
1
0
Returns: -1
In this situation you have no valid moves. All cells adjacent to the source cell are blocked, so you cannot walk anywhere. There are no other empty cells in your row or column, so you cannot teleport anywhere either. Thus, there is no way to reach the given destination.
{"......", "#####.", "#.###.", "#####.", "#.###.", "#####.", "#....."}
0
0
6
1
Returns: 5
012... #####. #.###. #####. #.###. #####. #54... The digits in the map above show an optimal solution. Each digit corresponds to the number of seconds between the beginning and the moment when you reach that cell.
{"##########","#.####.###",".#########","##########","##########","########.#",".#########","##########","####.#####","######.###"}
8
4
2
0
Returns: -1
{"##########","##########","##########","###.#.##.#","####.#####",".#####.###","#.####.###","##########","####.###.#",".##.#.####"}
9
0
8
4
Returns: 12
{"##########","#####.#.##","##########","####.###.#","########.#","##########","########.#","#.########","##.#######","########.#"}
8
2
3
8
Returns: -1
{"#.###.####","#.#....##.","###..####.","#.##..#..#","..##...#.#","###.#.#...","#.#.##...#",".###.###.#","##.#.###..","#.#.###.##"}
3
5
2
3
Returns: 3
{"...#####.#","#..##.....","#..#.#####","##.##....#","##.....##.","#####....#","##.##.#.#.","..###.#...","...###....","####.#..#."}
8
6
3
7
Returns: 5
{"##.#.....#","....#####.","...###..##","#.##.####.",".#.##.#.##",".#.##.####","##.###.#..",".##.##....",".#.##..##.","..###...##"}
9
5
2
6
Returns: 6
{"..........","...#.....#","#...##...#","..#..#.#..","..........",".#..##....","..........","......#...","#.#.##...#","..#......."}
1
0
0
8
Returns: 9
{".#........","#....#....","....#.....","...#....#.",".#........","..#.......","..........",".#......#.","...#......","...#......"}
6
2
6
9
Returns: 7
{"...#.#....","..........","#....#....","..#......#",".#..#.....","..........","...#.....#","..#..#...#",".#........","...#...#.."}
6
4
2
1
Returns: 7
{"##################################################","#####.######.############.################.#######","########.#########################.###############","#.###########.######.##.##########.############.##","########################################.###.#####","###.######################..##########.###########","##########.#######.#########.#####.##..###########","#############################..#######.###########","######################.###############.###########","#...###.##############################.###########","#############.############################.#######","#####..#.###################################.#####","###################.##############################","###########################################.######","##########.####################################.##",".#######.########.################################","##################.######.###.###.################","#####################.#######################.####","###########.#############.######.#################","######################################.###########","################################################.#","######.###########################.###############","##################################################","##################################################","################################################.#","#########################.########################","##########..#.###############.##############.#####","##################################################","###############.##############..#######.##########","#################################################.","################################################.#","#############.#########.##########################","############.#####.#############..####.###########","##########.########.##################.##########.","##################################################","###############.####..############################","##.################.####.#.#.######.#############.","##########################################.#######","########################.#########################","#######.###############################.##########","################.#################################","#########.###############.####.###################","##.###############################################","##########################.######.################","#############################.####################","####################.####.########################","##################################################","#####.######.#####################################","########################.########################.","########################.#########################"}
7
29
15
8
Returns: 12
{"#########.###.####################################","##.#.###############..############################","#.################################################","###########.########################.#############","####################################.#######.##.#.","#########################.########################","################.##########.#######.#####.#######.","#########################.###################.####","#########.##############.########.################","###################.##.###########################","############################.#####################","##.###.#################.#########################","#####.###########.######################.##.###.##","###.###.###################.###.#####.############","###########.######################################","###.#.############################################","###.##.#########.##############.#########.######.#","######################.##################.######.#","##################.#############.#################","#####.###############.####.##################.####","########.############.#################.##########","####################.############################.","##################################################","#################.########.#######################","##############.##########.#######################.","###############.############.#####################","####################################.###########.#","################.############################.####","###################################.#######.######","######.###################################.#######","#######.############.#############################","##################################################","###################.##########.####.########.###.#","###########################################.######","############################################.#####","#######.#####..#####.#####.####################.##","##################################################","###################.####################.#########","#################.#####.####.####.#############.##","########.########################.################","##.#############.#################################","#############.####################################",".#####################.#############.#############","###.##########.###############.##.####.########.#.","########.#########.###############################",".####.################################.###########","#########################################.########","#########.#############################.##########","#############.##################.##.##########.#.#","#############.##############..##########.###.#.###"}
15
5
19
45
Returns: 8
{"#########.################.###############.##.####","#######.################.#########################","################################################.#","########################.##############.##########","#####.############################################","###.###########.########################.#######.#","#..#############################################.#","######.#.#####################################.#..","############################################.####.","#######.#########.################################","#############.##############.#############.#######","#################.#################.###########.##","########.#########################################","#############..###################################","##################################################","###..####################.##########.########.####","##################################################","############.####.####.###########################","####################################.#############",".######################################.###.######","##############################.##################.","#################################.##############.#","######################################.######..###","####.####################################.########","#############################.####################",".#######################.######################.##","######.#################.######################.#.","########################.#########################","################.#################.#############.#","##############################################.###","################.###.##########################.##","##################.########################.######","##################################.###############","##############.#############.#####################",".####.############################################","#.#####.##############.###########################","########################.#########################","########.##.#######.##.###########################","##.###.####################.######################","######################.#########.##.########.#####","################################.#####.###########","#####################.#################.##########","#.################.################.#####.########","########.###########################.#########.###","##################################################","###.##############################.#####.#########","##################################################","##################################################","###.###########.####.#############################","######.###########################################"}
31
18
35
7
Returns: 8
{"####.######.######.#############.#######.#.#..#.##","########.######.#########################.###.####","####.###.#####.##.####################.########.##","#######.######.###########..####.###.#############","#######.#######.#.############.#################.#","###.#######.###########.#######################.##","#########.########.###.#####################.#####","#####.########.######..####.#####..###.##########.","################.#######.##########.############.#","#######.###################.#################.####","##.#####.#############.###################...###..",".############################.#.########..###.####","########.#.#######.#.####.#######.################","#####################.######.#####.#####.#########","#######.######.######.#.###.######################","######.#################.#.#################.####.",".#.####..###.#.#.################################.","########.############.#################.##########","################.##.####################.#########","######.#############.#####################.#######","###.##.##############################.####.###.###","##########################.###.#####.#########.##.","#####################.###########.######.#########","####.######.####.##.##############################","###############.##########.###############.######.","###############.############################.###.#","######.###.#########.################.#######.####","#############.######.########.######.##########.##","##.####.##################.############..#########","#################..#############.##.##############",".#####.###########.#.######.########.#####.######.","###############.##############.####.##############","################.#######################.#########",".#####################.#####.#################.###","###########.#####.#.#####..##.#######..######.####","##############.###..#####.#.#########.###.#.######",".#############..###.##############################","##############.########.#########.#############.##","###.#########.#######.#.#####.##########.########.","###############################.##########.#######","###########.#.##.############.#####.#######..#####",".##########.############.#######################.#","..###.#####.##..#####.#.#######.#####.##########.#","#.###.############################################","#######################################.###.######","######.############.####.###########.############.","##.#..##########.############################.####","#####.###.##############.####.####.##########.####","###.#.######..#####.##.#.##.########.###.#######..","##.####.##.###########################.####.######"}
30
0
17
8
Returns: 8
{"##.############..#######.#.##.####..#######.######","###########.#################.#########.####.#####","###.################.####.#########.########..##.#","####...########.########.#.#######################","##.#######.######.##########.#.###.##.###.#######.","###############.#.##########.###################.#","##.####.#######################.#.########.#######","##.########.####.#.##########.######.####.########","#####.####.#..#######.##############.#############","##.#############.####.##############.###.########.","########..######################..#.##############","##########.#.#####.##.############################","############.######.####...################.##.###","##########.###.######..############.#####.####.###","####################.#########.#####.#########.###","#.#######.#######.###.###.#####################.#.","######.###########.#####.#########..######.#######","#####################################.####.#######","############.###########.###############.#########","..############################..###.#.##.#########","###########.#######.####.############.############","###############################################.##","#######################.#.##.#########.#######.###","##.##################.#########.###.#.########.#.#","#####.#####.#.####################################","#######.########.#################.#########.###..","#############################.#.######.####.######",".##########################.#######.##############","####.####################################.#####.##","###.######.###########.###########################",".###########.###########################.#########","###.#####.##############..###################.##.#","###############.#####.#######.#.#####.##.#########","################.#####################.##.#.######","##.###################.##.#################.#.####","############.###.#.####.##############.###########","###################.#.#########.#.################",".#####..###################.###.###########.######","##############################.#.######.##########","######################.#######.###################","#.######.#####################.###.#.########.####","###.#######.##############.###.#.#########.#######","#.########..####.#.#####.#########.###########..##","####.###############.#####.####.##..##############","#..#######.#######################################","##..#.####.############...########################","####################.############.#.#############.","########################.###################.#####","########.###.#####################.###############","#.#.#####.######################.#####.####..#.#.#"}
28
41
26
31
Returns: 8
{"#########.#########..######################.####.#","..##################.########..######.############","##############.####################.#.##.#######.#",".##.#######.###################.#####.#######.####","#############################..#######.###..######","#.###############################.###.######.#####","#####.#########..#####.#####.####..########.######","###.#.###########.####################.###########","################.#########.##########.#####.##.###","#########################################..#######","#####.###########.##.####.##.######.#####.####.###",".##.########.####################.##.############.","############.##########################.########.#","#################.##########.#.###################","####..##..#######.#############.#########.########",".###.###############.###########.#################","######.###########.###############################","#########.#######.#########.###############.####.#","################.#.###########.####.##########.###","################.##.##.####################.######","#####..##############.###.#########.##############","######.###.#.######.#..###.##.####################","##########.##..##..##########.########.###.######.","##.##############.###########.###.#####.##########","##########.#########.##############..#############","####.##.########.###.##############.##.###########","####.###########.##.##.###########.#.##.##########","####.#####################.######.###.########.###","####.##.##.######.######.##.############.#########","########.#####.########.#########.#########.######",".#########.######..#.#################.#########.#","##.############.#####################.##..###.####","#######.#####.##################.#####.#.#########","#####################.#####.#########.###..##.####",".#.###.#.###################.######.##############",".####.##########.#.#########.####.########.#..####","#.############.#######################.##.#.#.#.##","##################.##..################.##########","##########.############.##########.####..####.####","############.####..#########################.#.###","##############.##############.####################","##############.###.######.##.#.####.#####.#######.","##############..####.#####.#########.#############","######..##############.############.##.###########","########.###.#########.###########################","############.#####.##############.#############..#","##.###################################.###########","##########.######.######.#######..##.########.####","################.####.#####.#####.######.#########","#############.##########.###.###########.#..######"}
48
40
38
40
Returns: 2
{"##.#.######.###.####.##.#####.####..##############","###########.#######.#..#########.#####..##########",".....#..#.##.#######################.###########.#","##..##################.####.###################.##",".###############.##.####.######.####.#.##########.","########################.#############.#######.###","#################.#######..######.#####.###.#.###.",".#####..###########.###########..#################",".#.############.###.###.#######.#######.#####.#.#.","#######.###.#######.#######.##############.#######","#.#################.#######..###########.#.##.####","####.#####.######.#####################.##########","#######.#########.#################.####.##.####.#","########..########.#####.#####.###################","#####.#..#.#####.###.##.##.##.#############.######","#####.##########.#####.#.#########.#..########.###","#.###########.################.#.######.#.########","########.#####..##################################",".##.##############.###############.##########.#.##","#############..#####..########.#############.#.###","#########.#############.##.#.#########.#.#####.###",".##.####.##################.######.####..#.######.","###.##########.#.######.####.#######.#####.#..####",".############.########.###########################","#########.####.######.#.##########################","############################.###############.#..##",".#####.###########.############.##.###.#########..","######.##############.####.#####.###..####.####.##","#.#..##.###.#################..#.########.########","######.#####.#######.#####.###.#.#########.###.###","#####.#.##############.#####.###############..###.","##.#############.#####.#########..################","###.#.########################.###################","#.###.######.#.######..#######.##.######...##.####","#########.#.##.##########.##.###..########.#######","####.###########.#########.############.#..###.###","#.#######..#############.########.##########.#####",".######.####.########.###.#######.#######.#.#.###.","###########.##.##############.##.##.#####.########","###########.#.#...#.##########.#####...#####.#####","#############.#..######...#########.##############","#.#####################.#.#.######..##.###..######","###.##################.######.##..###.##.####.####","#####.##.#############.##########.#######.####.###","###.##########.######.########.###################","#.###############.###########.############.##.####","#.##.#####.########.#####..####.#..##.#.###.#.####","##.#####..###.##.###.#.#######..###.###.##########","###########.#####.###..##.####.#.###.###..########","####..##.#############.#####################..#..."}
19
46
45
45
Returns: 12
{"#############.######.########.##.##.##.###.#######","##########.####.#.##.####.#####.########.#######.#","..##..#.######.##############.####################","####.#############.#######.########.#####.###...##","#######.##########.########.#######.##.###########",".########.####.#########.##################.######","###############################..#.######.####.###","########.########.#.##########.##############.####","#.####.######..####.###.########.####.####.#######","#####.#######..###.####.###############.####.#####",".######.#.##.#######.###..#..####################.","#####...##########.################.#####.####.###","###.###.#############.############################","##.#####.###..####.####################.#######..#","#.##.################.#.####.############.##.#####",".###.#########.#####.####.######.#################","###.##########.##.###..#.#######.############.####","############.##########..#############.###########","#############.#######.#####.#.#########.###.#..###",".#.########..###..##########..##.###.#############","#########.####.#.######.#####.################..##","######.##########################.###########.####","##.###########..##########.#.################.#.##",".########.......#####.###..##..#########.####.####","##.#.#############.##..#.##############..#########","#########...#####..############.####.######.####.#","####.#########.######.########.###..####.#########","#.######.###############################.########.","###.######.####.######################.#####.#####","##############.###.####..###############.####.####","#.#############..#...#########.####.###.#########.","#########.#####..###..##.#..#.##########.##.######","##.###.#####..##.##########.########.##.##########","####.#########.####...######.######.##############","##.#######.################.######################","#.##.###########..######.###.#.#######..##.#######","#########.################################.#.#####","#############.##.##.############.#############.###","###.#####################.##.###.###############.#","####.#.##.###.#.##.###########.##.#.###########.##","#####.######.##################.#.##.#############","#.##.##.##########.##.#.#########################.","####.######...###.############.############.##.###","####.#######.#.###.########.#############.########","#.###.#################.##.#####.############.####","####.##################.##############.########.#.","#######.##.###########.##########.####.###.#######",".####################.#####.####.################.","#############..####.###.#############...#####.#.##","#.#.##########.###.#######.#..######.#.#.##.###.##"}
0
35
38
25
Returns: 10
{"######################.#.#####..###.#############.","##.##.#####.###.###########.###############.#####.","############.###############################.#.###","#############.######################.########.##.#","#########.######.###..########.######.############","#.###############.##################.########.####","#.######.########.################.##############.","#.####.#..#############.####.####..##..######.###.","###.###.#############.###.###.##########.#.##.####","#######.###.######.#########.#########..##########","##.##...#.##..##.####..#..#####.####.############.","###########.#######.######.#.######.##.###.##.#.##","######################.#########.########.##..####","##.########.#############.#######.###########.####",".#######.##.#...#########.################.#.##.##","####.######.########.####################.###.####","#.#############.######.#.####################.##.#","###.###.##..###.######.#.###.####.##.#####.##.####","####....######.##.#.##.##.#.#######.########.#####","##.#####.################.###.########.##..##.####","#######.######.##############.####.########.#####.","####.######.#####..#####################.###.#####","########.########.######.##..####.#######.#.######","##.#####.######.#################.##.#..###..###.#","##################.##.######.######.########.###.#","#######.########.#.#.############..######.##.##.##","#####.###########################.##..#.####.#####","#####.####################.##.###.##.##.########.#","###.######.###########.########################.##","#.##...###.##########.#.#.###########..#.##.######","##########.####.##.######.#.#.#####.#.#######..#.#","####.########.###.###.####.#####################..","##.############.#######.#.#########.#.##.##.######","###.####.####.#####.###########.###.#####.########","##..###.#################..###..##.########.#####.","#.#############.####.#############################","#######.##.#######.#.##.#.########.###.#.####.####","###.##.#########.###.###################.####.####","####..#############.#######.##############.#######","#######..###.###########.#####.#################.#","####.###.#.########################.##..#.########","##############.########.###.#.#############..##.#.","#################..#####.#######..##########.#####","####.#####.##.###########.##.###############..##.#","##########.##########..#############.###.#########","##########.#####.#.###############.#########.#####","#########.#######################..##########.####","##.####.######.######..###########.#.############.","##.####.####..###############.######.#########.#.#","######.#.#.####.##########.##############.####.##."}
11
28
49
46
Returns: 14
{".#################.#########.#.######.########.###","##.####..############.#.#.##########..###..#######","####.##########.##############.#.######.##.#####.#","....#.########..##.###..##########.####.##.#######","###.##########.#######.#####..##.###########..####","#.############..###..##.#####.##############.#####","####.########..######...#.########.##.###########.","##.####..#.######.#.#############################.","..##..########.#.##.##.###.###.#.#####.###########","#..###.#########.#.#.#############.#####..######.#","##..###.#####.####.###..#.###.####################","###.############..##.#.##########.############..##","#########.#########.##############.####.##########","#####.######.###.###############.##...####.#######","#.##.######.#######.####.####.###...####.#.#######","#.########.#####..####.#######.####.#.#.#..#######","###.########.###.###.##.#######..###.#..###...#.##","##############.####.##.#######..############.###.#","##.##.###...#####.############.###.##.###.##..####","#.#######.#.#.###.#.#..##########.#######.########","#################.##.#########.##.####.##.####.##.","#.#..##############.#####.##.#.##.#.##############","######.##.##.#########.###########.########.######","#######.#.######.######.######.###.###########.###","###.#########.###.#.##.#######.#####.#############","################.####.############.###########.###","##.#.#.#######..##.##.######.###...#.#.######.##.#","##..#########.#########.#.########.#.....#########","#####.##.##.#.####.###.#..##########..###..####.##",".#########.####.####.##.#############.###.#####.##","########.####.#########..###.###.###.##.########.#","####.##.######.########..#.#######.###############","##########.###.##########.##########.####.#####.##","###.#.#####.#.#.#####.########.######.###.####.##.","##.######.########.##.##############.#.####..#####",".#.######.#.###.#############...####.###.#.#######","########.########.####..###.######.#####.########.","#############..#.##..###.###########.#.#...######.","####.###...#####.#####..#########..###..##.#######","#####.##.####.#...####..#########.#####.#.##.#.#.#","###.#.############.###.##########.##.########.##.#","#########################.###.####..####.#######.#","####.#.###.##.##############.#.###.##.#########.##","#.####.#########.###.#.#.########..##..#..###.#.#.","####.#########.#.#.####.###.#############.#.##.#..","##########################..#########.############","#############..###.####.#.#.######..###.##.#####.#","#####..###.##########.#.####.####.######.###.##.##","####################.#.####.###.#.###########..###","##.####.####.#..##.######.##.######.#########.###."}
26
32
11
47
Returns: 12
{"########.#.####.#.##.#####.###########.....#######","#.#.####.#..##.####.#.######.####.#####.#.##.####.",".##..####.##.###.##.###.##.#.#####.#..############","#.########.#.#############..##...#########.#.####.","##.#....#..####.#..###.############..###.#.###.###","####.##.#.###############.#########.##############","######.#.####.######.###########.#####..####.#####","###.###.####.######.###.###.#.####.##.#########.##","#.###.####.#######.##########.##..####..####.#####","########.##.###.#.#.####...#####.####.#####.######","######..#.#######..#.##########.###..#####.#######","########.#.##.###.##.#####.####.###.##.#.##.##.#.#","#########.#.##.#.#########.##########...#####.###.",".#####.#.##################..#..#############..#..","###.###.##.#############.########.##..#####.##.###",".#.######.###..#.####.####.#.#.#..#..#.####.######","#.#.#########.##.....##.#######.####.#######.#####","#####.###.##.########.##############.###.####.####","#####..####.#######...########.#..#.##..#..#...###","########.####.####.########.##.###################",".#######..#..######.############...#############.#","#########.##.###..#.###.##.#.##.##.#.#############","####.#############.#.##.####..##.##.######..#####.",".######.###.####.#####.###.########.#.#.####.###..","###.##############.##.#.####.######.###.##########","##..#..#######################.#..###.##########.#","..#####..########################.########.#######","#############.###...####..######.#####..######...#","################################.###.##.####.#####","..####.###.##.#.###.###..#########################","#####.################.####.#..################.##","###...########..#########.#.#..##..###.######.####","##########..#############.###########.#########.##","##.#########.##..#######.####.#..#.#####.#..#.#.##","########.#######.####################.###.#...####","#####.##.##.#.#########.######.#####..############",".##.#####.#.######################.###.#.#..######","##.#########.#.#######.#####.#.####.##.####.##.##.","#####.######.##..#..#.####.###.############..#####",".##.######.########.#######.#######.####.##..####.","########.#.###########.######.####..##.###########","####.##.####.#######.#.####.############..########","####.#.######.#####..##############.#########..##.","####.###############..###..####.#######.####.###.#",".#.###########.####.#######.##..###.#####...######",".##.....#######.#######.#.#...###.####.#######.###","#####.##..#######.##.####.##.#.#######.##.#.######",".##.##########.####..######.##.###.######.###.####","######.###.####.######.###.####.#####.#######.#.##",".#####.#..####.#####.###...#####.#.####....#####.."}
42
19
21
9
Returns: 11
{"##.####.###.#.##.#.#############.#################","####.#.###.#.##.###############..##.###.#.######.#","###.#.##.####.##.######.#.#########.####.#.###.###",".#####.########.##.#..##.#.#.#.##.#.###.#.########","#..#######.######...###...#####..#############...#",".######.######.######.#####.####..###########..###","###.##..##.###########.###.######.#.######.##.####","####.###########..###.####.#########..#.###.###.##","####.#########.#######.####..##########.##.##.##.#","######..####.#..#####.############.###..########.#","#.#.###...##...#.######.######.####.####.######..#","###.##############.##..#####################.#####","#.###.##########.##.###..#..#######.#.###.#####.##","#..###..###.#....##.#####.#######.#########.#####.","#########.##.#####.##############.##...##.#..####.","#.####..######.##################..###.#########..","###.#.#..####.####.#######.########.#.##########.#","#########.#################.##..###..####.#####..#","##.#.#####.###############..#####.#.####.######.##","##.#####.###########..###.##.#####.####.##.#######","#.######.####.####.##.#.##########.######.########","###.#.###.#####.###..##.#####.######.##..###.#####",".#######.#####.###.###.####.#######.####.###...###","#########.###.##.##.###.###..####.#.#######.###..#","##.#.#.##.##.#####.##.####.####.####.#######.####.","######.#########.#####.#######.#.###....###.######","#.#####.#.##..##.#####.########.###..####.###..#.#","#.####.#####.#.##########.#.###########..##.#.####","##.#############..#..####.########..##.#.#.#.#####",".####.#.##########.####..####.##.##..##.#.########","#.##.####.##.########.#.##.#.#.##################.","##.#..####..#....######.##.##..########.#######.#.","#######..#.#..###.#..#########.############.###.##","#.#.#..###..########.####.#####.############...###","###..#########.##.##.#...##.#.###.######.###..###.",".##...#######.#.##.###.#######.##.###.#.##########","##..#####.####..##.####.####################..##.#",".#######..######.##.##########.###.#.######.##..#.","##.###.#.##.###.#########.##########.#######.#..##","###.#######.#.#####.#######..########.############","###.#####.####.############.#..#..##.#######.#####","#.#######.#######..#####....####.##.####.######.##","#..######.###.#.##..###########################..#","####.##.##.######.##############.####.############","#####################.#####..#.#######..####.####.","######.#.#####..#.##.#..#.###.####..##.##.########","###.#####.#########.#.####.##########.#.#.###.###.","###########.##..##############.####.####.#.###.#.#","########.####.##########.##########..##########.##",".#.#..##.##.###.#####..#####.#####.##.###.###..###"}
36
45
48
8
Returns: 14
{"##..#####.###.##.######.##..#.##########.##.####.#","#.###################.###########.##.#############","#####.#.####.####..#######.##.########.###########",".#..#########.##############.##########..##.##.#.#","##########.##.#.#..###.###.##.#.#..###############","#..##.#####.####.##.#.#####.###.#.####.#.####.####",".######################.########.####..#######.###","#..####.####..###.###.#.##.#####.##########.###.##","####.##############..##.#########.#######.###.##.#","##########.###..####.#####.####.#############.##.."}
2
29
4
26
Returns: 4
{"####.####.###.##########..###....###.###..#######.",".#####.#.#.###...##########.############.###.##.##","#######.#..##.#.########..###########....##.######","################..#.#######.###########.####.#.###","#######.######..#.######.###########..######.###.#","#.#.##.#######.##.##########.##.#.###..###.###.###",".###.#######.########.###.#.##############.#.###.#","##....###.##.#############..#.#####.#.#.###.#.##.#","###...####.#####.##.###.####.###################.#","####..########.##.#.##.##################.#..#####"}
4
37
4
14
Returns: 8
{"#####.##.#.##.##############.##.##########.#####..","#######.####.#####.#.##.##.#######.####.####.##.#.",".#..#####..#..#########.###..######.####.###.#..#.","##.#####.###.#######.#####..######...#######.#####","########.##.#####.###.#########.#########.########","#.###.####.##.#.#.#####.#########.##.##.#.########",".###..####.#########.###########.####..##########.",".#.######.##.#############.######.######..#.#.##.#","#####.###.##..##.#.#####.###############..#.###...","#########.#.#.###.##.######.#.#############.#.####"}
6
38
1
34
Returns: 13
{"#.######.#","##########","####..#..#","#.#.######","###...####",".#########","##.#..##.#",".######.##","#######.##","##.####.##",".########.","..##..#.#.","#####.####","#######.##","#.####.###","######.###","##########","..###.#..#",".#..##.###","##.#####.#","#####.####",".#########","##########","#.########","###.###.#.",".######.##","###.######","#####.#..#","...#######","###.######","#########.","##########","..##.#####","######.##.","##.####.##",".###.#..#.",".####.####","###.##...#","####.#####","######..##","####.#.##.","#####.####",".###.###.#","#.######.#","##########","#.####.###","#####...##","##.####.##","#####.#.#.",".#####..#."}
4
5
43
8
Returns: 13
{"#.######.#","#.########","#####.###.","##.####.##","######..#.","#####.#.##","...#######","#.#.#.###.","###..###..","####..####","##########","###..#.###","#.##..###.","###.######","####.###..","#.####..##","#..###..##","#########.","###.######","##.#######","##########","##########","##########","#.#.#.####","######.###","###.#.####",".#########","###..#####",".#####.#.#","######.###","####..####",".####.###.","#.#######.","##########","##########","##.##.##.#",".##..#####","#..##.##.#","#####..#.#","###.##..##",".#########","##########","####.#.###","########.#",".#########","##########",".###.#####",".#######..",".#######.#","#.########"}
42
6
18
3
Returns: 13
{"###.###..#","#.####.#.#","##..#.##.#","#..##.#.##","#.######.#",".#####.###","##.#######","##.######.","#######.#.","###.######","###.######","##..#.#.##","#.####.##.","#.#######.","#####..##.","###.######","##.#.#####","#.########","##.###.###","##.##..###","##.##...##","#########.",".########.",".##.######","########.#","######.###","#######.##","#.########","#.#.######","###.#####.","#.#..##.##","#.#.##.###","##.#.#####",".###.#####",".#########","###.#.#.##","####.#####",".##..#####","##########","#######.##","#.###...##","##########",".#######.#","##########",".##..#.##.","####..##.#","#.########","#########.","###.#..###","###.#####."}
2
3
35
7
Returns: 14
{"######.#############.########.###################","########.####.##############.##################.#","#######..##.###.#######################.#########","##################.###################.##.#.#####","########.#######.#################.###..#######..","###############.###########.############....#####","####.#######.################..###########.#####.","#####################..##########################","##################.###.############.#############","###########..#########.##################.######.","##################.###.##########################","###################.##############.###.##########","#########.#..###.######################.#########","#..#######.##.##.##########################.###.#","############.#################.##################","######################.##.##.####################","##########.##.#################.#################","##########.#######################.#.#..#########","###.########..###################.###############","#.######.######.#########.#####..####.###########","############.####################################","###########.#####################################","#####.###########.##.######.##############.######","#########################.###########.###########","###.################.############.###.#####.#####","#############################.##############.####","################.#####.#########.##########.#####","#.#####.######.#.##########.####.#.#.######.#####","..###############################.###############","#########.######.#.#####.####.######.#####.######","####.####.#######################################","##.###.#.######.########..##########..###########",".###########.##.#.##############################.","##..#########.##############...#################.","######.######.##.#######.########################","###.#####.#######################################",".###############################.################","####.##########.#.########.#.#######.####.#####.#","###.###################.############.########.###","##############.###########.##.##.#############.##","####.############.###############.#######.#.#####","#################################################","#######.##.###############.##########.###.#..####","##############.#######.#############.##.#########","###.#.#########################.#######.########.","##.###############################.#############.","########.####.#######.###########################","######.#.#.#.##############.##.#####.#.#########.",".###.############.#####.#########################"}
12
9
18
33
Returns: 10
{"#####.############.###########.##################","#################################.###############","#######################.######.##########.##.####","##########################.######################","##########.#########..#####.#########.###########","#############.############.###########.#####.###.","##########.#########.####.########.##############","##.#############################.######.###.####.","##.#..#..#######..#.###########################.#","######.###############.#####.###.######.#########","##.#################..#######.#.#########.#######","###############.##.##########.###################","#########################..####.###########.#####","#####.##########.#####.########.##..####.####.###","####.##################...######.#####.##########","#########.###########..##.#######################","#####.##.#####.#####.#####.#############.########","##################.##...#.######.#######..######.","#########.####...#####.#..####..##########.##.###","#####.#############.######.###.###.##############","####..###.################.######.######.########","######.###.####.#########.###################.###","######################.###########.##############","######.#############.#####.###.########.#########","####.###.####.#####################..###.#######.","#####.#################################.##.######","#############################.####.###.####.#####","###.###############.########.###..######.##.#####","###############.########################.########",".##.##.###.########.####################.########","##################################.##.###.#######","###..##.#.####################################.##","##########.###############################.#.#.##","#########################################.#######","######################.###########.#.############","##########################################.######","##.####################.#####.###################","#########.#.###.###.#########.###############..##",".#########.######..#####################.####.###","#######.#...######.###.##.#######.####.####.#####","##########################..#####################","#########.##########.####.###############.#######","#.##.########.###.####.###############.#######.##","#########.#####..#####.########.###########.#####","#########.###.######################.#######.#.##","##.#####.#########..############################.","##.######.#####.########..##..###################","##.################.#########################.###","#########..####.#.#######...##.#######.##########"}
39
10
9
32
Returns: 15
{"################################.#####.##.#######","#####.####################.#####.#######.########","#.#.#############.########################....#.#","#######.##################.#.####.###############","###################.#############################","####..##############.############.##.#########.##","######.##.#######################.############.##","###.###.#################.##############.########","#######..#.#############.######.############.####","####.##########.######.##########################","##########..#.#######..##########.###############","########.######.##############.##################","##################################.############.#","#################################################","##################.###################..#########","##.####.###########.##.#.###########.############","######...###.##.##################.##.###########","####.###.###########..###########################","####.####.##############.#.#####...############.#",".#########.###.################################.#","############.##############.#####################","####.######..####################################","##########.########.#############################",".######.###########.#######################.#.###","############.################.#.##########.####.#","#.#.###############.####.########.####.####..####","#.#.#.###.###########.##########.#####.####.#####","########.#.############.##.######################","##########################.##.##############.####",".###########.##.########.########.#####.#.#######","########.##.#########################.########.#.","###.####.############.##..###.###.###############","##.#######.##################.#.##############.##",".####.#.##.######.###############################",".####.##.#########..#.###.########.######.###.##.","####################################.####.####.#.","##########.##############.#######################","##########.#####.########.###########..##########","#############################.###..#############.","############.###.##.###################.###.#####","#########.####.#########.####.###.########.######","##.##################.#..#######..###############","####################################.#.##########","####.#############.#########..###.###############","###.###########.########.################.####.##","#######..########################.#.####.########","####.#######################################.####","#.##############################.#############.##","#####.####.##.##########.###########.####.#######"}
27
23
47
1
Returns: 9
{"........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................"}
18
4
2
24
Returns: 36
{"........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................"}
17
6
25
36
Returns: 38
{"........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................","........................................"}
4
31
7
8
Returns: 26
{"..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........","..........",".........."}
23
4
23
8
Returns: 4
{".................................................."}
0
2
0
13
Returns: 11
{".........#.#......#....##..........#.#....#......."}
0
41
0
47
Returns: 6
{"#",".",".",".",".","#",".",".",".",".",".",".",".",".","#",".",".",".","#",".","#",".",".","#",".",".",".",".","#","#",".",".",".",".",".",".",".",".","#",".",".",".",".",".",".",".",".",".",".","."}
35
0
26
0
Returns: 8
{".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".",".","."}
37
0
10
0
Returns: 27
{"......","######",".####."}
0
0
0
5
Returns: 5
{"......","######",".####."}
0
5
0
0
Returns: 5
{".####.","######","......"}
2
0
2
5
Returns: 5
{".####.","######","......"}
2
5
2
0
Returns: 5
{".#.",".##",".##",".##",".##",".#."}
0
0
5
0
Returns: 5
{".#.",".##",".##",".##",".##",".#."}
5
0
0
0
Returns: 5
{".#.","##.","##.","##.","##.",".#."}
0
2
5
2
Returns: 5
{".#.","##.","##.","##.","##.",".#."}
5
2
0
2
Returns: 5
{"....",".##."}
0
0
0
3
Returns: 3
{"....",".##."}
0
3
0
0
Returns: 3
{".##.","...."}
1
0
1
3
Returns: 3
{".##.","...."}
1
3
1
0
Returns: 3
{"..",".#",".#",".."}
0
0
3
0
Returns: 3
{"..",".#",".#",".."}
3
0
0
0
Returns: 3
{"..","#.","#.",".."}
0
1
3
1
Returns: 3
{"..","#.","#.",".."}
3
1
0
1
Returns: 3
{"......",".####."}
0
0
0
5
Returns: 4
{"......",".####."}
0
5
0
0
Returns: 4
{".####.","......"}
1
0
1
5
Returns: 4
{".####.","......"}
1
5
1
0
Returns: 4
{"..",".#",".#",".#",".#",".."}
0
0
5
0
Returns: 4
{"..",".#",".#",".#",".#",".."}
5
0
0
0
Returns: 4
{"..","#.","#.","#.","#.",".."}
0
1
5
1
Returns: 4
{"..","#.","#.","#.","#.",".."}
5
1
0
1
Returns: 4
{"#.", ".#" }
0
1
1
0
Returns: -1
{".##.", ".###", ".###", "...." }
0
0
3
3
Returns: 4
{"..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", ".................................................." }
49
48
1
1
Returns: 95
{".#...#", "#...#.", "......", ".#...#" }
0
2
2
5
Returns: 5
{"..##.", "##...", ".##.#", "....." }
0
1
1
3
Returns: 4
{"...###.", "...###.", "..###.." }
2
6
0
0
Returns: 6