Statistics

Problem Statement for "GreedyGlob"

Problem Statement

Your mad scientist employer has left you in charge of the lab tonight, and one of her fiendish creations has just escaped its container. The Greedy Glob is a dangerous organism that grows very quickly. You need to escape the lab to get help while avoiding being eaten by the Glob. Luckily, you know the layout of the facility so you can plan your escape route. The layout will be given to you in the elements of lab, and will look something like this:

 

***.**
*S...*
*..G..
*.....
*.****

 

'*' characters represent walls you may not pass through while '.' characters are open space. 'S' represents your starting position while the 'G' represents the initial square covered by the Glob. Your goal is to exit the building by moving to a position outside the grid. You get to move first, and on each turn you may move one square North, East, South, or West - or you may remain in the same place.

 

After each of your moves, the Glob grows. The Glob grows either horizontally or vertically each turn. When the Glob grows vertically, this means that each non-wall square vertically adjacent to a Glob square becomes a Glob square. Similarly, horizontal growth means that all non-wall squares horizontally adjacent to a current Glob square become Glob squares. All squares that were previously Glob squares will also remain covered by Glob. The Glob chooses to grow horizontally or vertically in a greedy manner - it will choose to grow in the direction that will lead to a greater total number of Glob squares at the end of its current turn. If this is a tie, it will grow horizontally. The Glob does not grow beyond the bounds of the grid, and does not count positions outside of the grid when deciding which direction to grow.

 

You may not enter a Glob square, and if the Glob takes over the square you're on then you are eaten immediately. Return the minimum number of moves required to escape the lab (by leaving the area covered by the grid), or -1 if no escape is possible.

Definition

Class:
GreedyGlob
Method:
escapeTime
Parameters:
String[]
Returns:
int
Method signature:
int escapeTime(String[] lab)
(be sure your method is public)

Constraints

  • lab will contain between 1 and 50 elements, inclusive.
  • Each element of lab will contain between 1 and 50 characters, inclusive.
  • Each element of lab will contain the same number of characters.
  • Each element of lab will contain only the '.', '*', 'S', and 'G' characters.
  • Among all elements of lab, there will be exactly one 'S' character and exactly one 'G' character.

Examples

  1. { "*****", "*S...", "*****", "*.G.*", "*****"}

    Returns: 4

    The Glob is sealed in the bottom area, leaving you free to walk out to the right.

  2. { "**.*", "..G*", "*S.*", "**.*"}

    Returns: 3

    You will move one square up, then the Glob will grow vertically (in order to grow by 2 squares instead of 1). Then you'll go left, narrowly escaping the Glob which will now grow horizontally. On your third move, you escape.

  3. { "**.*", "..G.", "*S.*", "**..", "****"}

    Returns: 4

  4. { "**..*", "*S..*", "*.G.*", "*..**"}

    Returns: 3

  5. { "*****", "*S...", "*..G*", "*****"}

    Returns: -1

    The Glob will grow vertically on its second move, sealing you in forever!

  6. { "**************************************************", "*S...............................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "**********************************************..**", "*..............................................*G*", "*.************************************************"}

    Returns: 1172

    Runtime varies with total moves - but is otherwise fairly flat (by design). Here we have 1172 moves running in .25'ish. Total moves certainly can't be higher than 2500 - so we should be clear.

  7. { "*******************************", "*...............S.............*", "*...*********************......", "*..................G..........*", "*.............................*", "*.............................*", "*******************************"}

    Returns: -1

  8. { "*******************************", "*...............S..............", "*...*********************......", "*..................G..........*", "*.............................*", "*.............................*", "*******************************"}

    Returns: 15

  9. { "***************************", "*.........................*", "*.........................*", "*.........................*", "*.........................*", "*........S.................", "*.........................*", "*.........................*", "*............G............*", "*.........................*", "*.........................*", "***************************"}

    Returns: -1

  10. { "***************************", "*.........................*", "*.........................*", "*.........................*", "*.........................*", "*.........S................", "*.........................*", "*.........................*", "*............G............*", "*.........................*", "*.........................*", "***************************"}

    Returns: -1

  11. { "***************************", "*.........................*", "*.........................*", "*.........................*", "*.........S...............*", "*..........................", "*.........................*", "*.........................*", "*............G............*", "*.........................*", "*.........................*", "***************************"}

    Returns: 18

  12. { "**************************************************", "*S................................................", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*.......................G........................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "**************************************************" }

    Returns: 49

  13. { "************************.***", "*..........................*", "*...........******.........*", "*..........................*", "*..........*...*...........*", "*..........*...*...........*", "*.....******...********....*", "*..S.........G.............*", "*..........................*", "*..........................*", "*.....*****************....*", "*..........................*", "*..........................*", "*..........................*", "*..........................*", "****************************"}

    Returns: 29

  14. { "************************.***", "*..........................*", "*...........******.........*", "*..........................*", "*..........*...*...........*", "*..........*...*...........*", "*.....******...********....*", "*............G.............*", "*..S.......................*", "*..........................*", "*.....*****************....*", "*..........................*", "*..........................*", "*..........................*", "*..........................*", "****************************"}

    Returns: -1

  15. { "****************************", "*..........................*", "*..........................*", "*..........................*", "*..........................*", "*..........*****...........*", "*..............*............", "*............G.*...........*", "*..............*...........*", "*...S......*****...........*", "*............*.............*", "*..........................*", "*..........................*", "*..........................*", "*..........................*", "****************************"}

    Returns: 31

  16. { "****.***********************", "*..........................*", "*..........................*", "*..........................*", "*........G.................*", "*..........................*", "*...........................", "*..........................*", "*..........................*", "*...S......................*", "*..........................*", "*..........................*", "*..........................*", "*..........................*", "*..........................*", "****************............"}

    Returns: 19

  17. { "****.***********************", "*..........................*", "*..........................*", "*..........................*", "*........G.................*", "*..........................*", "*...........................", "*..........................*", "*..........................*", "*...S......................*", "*..........................*", "*..........................*", "*..........................*", "*..........................*", "*..........................*", "*****************..........."}

    Returns: -1

  18. { "****.***********************", "*..........................*", "*...........****...........*", "*..........................*", "*.....*..G.................*", "*...........*..............*", "*.................***.......", "*....**.....*..............*", "*..........................*", "*...S.......*..............*", "**.******************......*", "*..*................*......*", "*..***.********......*.....*", "*......*........*****.......", "*..*****...............*.*.*", "*********************......."}

    Returns: 27

  19. { "****.***********************", "*..........................*", "*............****..........*", "*..........................*", "*.....*..G.................*", "*...........*..............*", "*.................***.......", "*....**....................*", "*..........................*", "*...S.......*..............*", "**.******************......*", "*..*................*......*", "*..***.********......*.....*", "*......*........*****.......", "*..*****...............*.*.*", "*********************......."}

    Returns: -1

  20. { "****************************", "*..........................*", "*..........................*", "*......*..*****............*", "*......***.................*", "*......*..S.................", "***********...**************", "*..........G...............*", "*..........................*", "*..........***.............*", "****************.***********"}

    Returns: 18

  21. { "*****************.**********", "*..........................*", "*..................*****...*", "*......*..********.........*", "*......***............*....*", "*........S............*.....", "*..********...**************", "*.....*....G.......*.......*", "*.....*....................*", "*..........***.............*", "****************.***********"}

    Returns: -1

  22. { "**************************************************", "*S................................................", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*.......................G........................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "**************************************************" }

    Returns: 49

  23. { "**************************************************", "*S...............................................*", "*************************.**********************.*", "*...............................................**", "*************************.**********************.*", "*...............................................**", "*************************.**********************.*", "*...............................................**", ".************************.**********************.*", "*...............................................**", "*************************.**********************.*", "*...............................................**", "*************************.**********************.*", "*...............................................**", "*************************.**********************.*", "*...............................................**", "*************************.**********************.*", "*...............................................**", "*************************.**********************.*", "*...............................................**", "*************************.**********************.*", "*...............................................**", "*************************.**********************.*", "*...............................................**", "*************************.**********************.*", "*...............................................**", "*************************.**********************.*", "*................................................*", "*************************.*********************..*", "*................................................*", "*************************.*********************..*", "*................................................*", "*************************.*********************..*", "*................................................*", ".***********************************************.*", "*................................................*", "************************************************.*", "*................................................*", ".***********************************************.*", "*................................................*", "************************************************.*", "*................................................*", "************************************************.*", "*................................................*", "************************************************.*", "*................................................*", "************************************************.*", "*...............................................G*", "*.************************************************" }

    Returns: -1

  24. { "**************************************************", "*S...............................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*...............................................**", "*************************.**********************.*", "*...............................................**", "*************************.**********************.*", "*...............................................**", "*************************.**********************.*", "*...............................................**", "*************************.**********************.*", "*...............................................**", "*************************.**********************.*", "*...............................................**", "*************************.**********************.*", "*...............................................**", "*************************.**********************.*", "................................................**", "*******************.*****.**********************.*", "**..............................................**", "*************************.**********************.*", "*...............................................G*", "**************************************************" }

    Returns: -1

  25. { "**************************************************", "*S...............................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*...............................................**", "*************************.**********************.*", "*...............................................**", "*************************.**********************.*", "*...............................................**", "*************************.**********************.*", "*...............................................**", "*************************.**********************.*", "*...............................................**", "*************************.**********************.*", "*...............................................**", "*************************.**********************.*", "*...............................................**", "*************************.**********************.*", "................................................**", "********************.****.**********************.*", "*...............................................**", "*************************.**********************.*", "*...............................................G*", "**************************************************" }

    Returns: 93

  26. { "**************************************************", "*.................................................", "*S...............................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*.......................G........................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "*................................................*", "**************************************************" }

    Returns: 50

  27. { "**************************************************", "*S...............................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*.................................................", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*.G*.............................................*", "************************************************.*", "*................................................*", "**************************************************"}

    Returns: 541

  28. { "**************************************************", "*S...............................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*.................................................", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "***********************************************.**", "*................................................*", "*.************************************************", "*..G*............................................*", "************************************************.*", "*................................................*", "**************************************************"}

    Returns: 541

  29. { "**************************************************", "*S...............................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*.................................................", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*................................................*", "************************************************.*", "*................................................*", "*.************************************************", "*G..*.........*..................................*", "************************************************.*", "*................................................*", "**************************************************"}

    Returns: 541

  30. { "*....*.***..**.**.*..*........**.**..*...*.....*..", "..**.......*.......*.*..*......**..*..........*...", "......*....*.*.*..........*......**..*........*...", "*......*........*.**.....*.*.....*....*..**.**....", "..*.......*........*...*.*.*.*..*......*....**.**.", "*....**..*...*.......*..*.......*.*....**....*..**", "**.**..**..........*..*..*...*...*.*..*.....**.*.*", "....*.*..*.*.*..*..*..*........*..*.**..**........", "..*....***......**.*...***...*............****.**.", "...........*...*.*..*....*.*..*....**....**.......", "**...........*........**..*...**..*.*...**...*.*..", "*......*.....*..*.**.*.*..**...*..*.**.***........", ".*....**......*...*..*.*....*...*.*..........*.**.", ".*...**.*.......*............*...*..*..***..**....", "....*...*....................**......*..*.....*..*", "..*.*.**.***.....**.......*.....*.*......*...**.**", "....*.....**....*..***.......*...........*.......*", "...*.**.........*....*...**..*....*...*.**.*.*....", ".*.....*..*..*..****...*..*.....*.**.*...........*", ".**.***..**.*..***.*.****.*....**.*.*.*..*.****.*.", ".**........*.....*.*.**......*.....*.*..*....*....", ".*...*..*...*....*....*..*.*........*.*...**.....*", "*.**....*.*.....*.**.**......*.......**...*.*.....", "*..*..*..*.*..*...**.*S**..*.*....**..*...*.*...*.", "..*.*...**..**...*......**....*..*..**.....*......", ".*.*.*...*.**...*.*...*.**...**..........**..**.**", ".....*..*......*.......*..*...*.**....*..*.....*.*", "..*.*.*.....*..*.*.**.G.**...*....**.....*....*...", ".....***..*.****.*.***.*......*...*.***..........*", "...*.......*.*.**.*..*.*.**.....*...*.......**...*", ".....*.*...****......*.*..*.......**.....*..***..*", ".*..*....*.*..*....*......*****.*..**.............", "..*..*.....*.....*....*....***......*.*...**...*..", ".**.*.**.*.....*....*..*......*........*...*....*.", "..*.*................*..**..*....*..**....**.**...", "...........*..*..*.*..*.....*.**.**...***......**.", ".**....**.*....*..*..*****.....*...*.*..**........", "....**...**..*........*....*...*..*.*...*......*.*", ".....*....*.*.......*.....***...**......*.**.*..**", ".....*.*.*.*.....*.**.......*.*..**.....*.**.*...*", ".*....**.........*.**....**....**.**.*..*.*......*", ".....**.**..*....**.........*...****..*..*..*....*", "*.*.****...*...*.....*....*....*..**......*......*", "...**.*.**....*..*.*...*..*......**.*.**.........*", "....**....*..........*.*.*....*..*.*..***.....*...", "...*......*.*......*...*....**..**...*..**..*..**.", "...**..*.*.*....***.*.....*.........**...*....*..*", "..*.*.*...*...*...*.....*..*...*....*..*.*...***..", "...**..*.**.......**.*..*....**....*.....*.*..**.*", ".*.***...**......*.....*.*..*..*.*.*.*.*....*.*..*"}

    Returns: 34

  31. {"SG"}

    Returns: 1

  32. {"G","S"}

    Returns: 1

  33. {"G.*","*S*","***"}

    Returns: -1

  34. { "******************.*G", "*S.................*.", "*****************..*."}

    Returns: 18

  35. { "*************************************************", "*...*...*...*...*...*...*...*...*...*...*...*...*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.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...*G*", "*************************************************"}

    Returns: 1006

  36. { "*************************************************", "*...*...*...*...*...*...*...*...*...*...*...*...*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*", "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.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", "*.*...*...*...*...*...*...*...*...*...*...*...*G*", "*************************************************"}

    Returns: 1006

  37. {"*****", "*S...", "*..G*", "*****" }

    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: