spoj#ALCATRAZ3. THE HONEYCOMB MAZE
THE HONEYCOMB MAZE
本题没有可用的提交语言。
You won the lottery tickets to visit the famous Disneyland HongKong with the Taarak Mehta ka Ulta Chasma family and Subramaniam Iyer gets stuck in the Honey Comb maze. He has a Phone along with him and no one else to help him out. He calls you and asks for help. Chuck the story getting into the problem now , There are N x M blocks of Honey combs in the maze and you are given a starting point. your task is to help Mr. Iyer find out whether or not he can traverse the maze and return to his original position. The constraint being that a honey comb ( Block ) once visited cannot be visited again . Also , he has to make a minimum of 'k' number of moves before returning to the starting point . The '.' represent the emty blocks whereas the '*' represent the blocks that can't be visited . from a block (x,y) Iyer can move only to blocks (x-1,y) , (x+1,y) , (x,y+1) , (x,y-1) . Help Mr. Iyer return to his original position.
Input
The first line of the input contains the dimensions of the maze ( N x M).
Second line of the input contains 'k' as described above .
The third line denotes the coordinates of the starting point ( 1-n ) , ( 1-m ) .
The next N lines contain the description of the Nth row .
Output
Output "YES" if it's possible .
Else output "NO" .
Constraints:
1<=N,M<=100
Example
Input: 5 5
14
1 2
. . . * *
* . . . *
* . . . .
. * . . .
. * . . *
Output: YES
Explanation of the test case :
1,2 - 2,2 - 3,2 - 3,3 - 4,3 - 5,3 - 5,4 - 4,4 - 4,5 - 3,5 - 3,4 - 2,4 - 2,3 - 1,3 - 1,2
14 moves were made ( No. of dashes ( - )) .
So , its possible . Also , no blocks were repeated .