ALLIZWEL - ALL IZZ WELL
ALL IZZ WELL
Mr.ESP used to tell “ALL IZZ WELL” whenever he gets into any trouble. So his friends and the people around him used to laugh at him. But Mr.ESP is very strong in his belief. He believes that the term “ALL IZZ WELL” will make everything fine. Now your task is to ignore the story above and find whether there is a path in the given matrix which makes the sentence “ALL IZZ WELL”
There is a path from any cell to all its neighbouring cells. A neighbour may share an edge or a corner.
The first line consists of an integer t representing the number of test cases.
The first line of each test case consists of two integers R and C representing the number of rows and number of columns in the matrix. The description of the matrix follows.
For each test case print “YES” if there is a path which makes the sentence “ALLIZZWELL”. Else print “NO”.
Note: Take care of 4th test case
There is a new line after every test case in the input.
t <= 1000
R <= 100
C <= 100
5 3 6 AWE.QX LLL.EO IZZWLL 1 10 ALLIZZWELL 2 9 A.L.Z.E.. .L.I.W.L. 3 3 AEL LWZ LIZ 1 10 LLEWZZILLASample Output:
YES YES NO NO YES
Important: the path cannot cross the same coordinate twice!
nice one! Just require the knowledge of recursion.
http://ideone.com/MSeO3x WA please help, exploited every test cases still :(
i dont understand why i am getting WA?
Nice problem! :)
can anyone clarify what a neighbouring cell means? are the neighbours cells the eight cells surounding a given interior cell?
why iam getting compilation error every time. plz suggest some solun..
Do not assume that there is only an 'A' to start, cost me many silly WA :(