ALLIZWEL - ALL IZZ WELL


ALL IZZ WELL

Problem Description:

     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.

Input Specification:

     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.

Output Specification:

     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.

Input constraints:

t <= 1000
R <= 100
C <= 100

Sample Input:

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
LLEWZZILLA

Sample Output:
YES
YES
NO
NO
YES

hide comments
kingfran1907: 2018-01-08 11:30:38

[spoiler] didn't work!

Last edit: 2018-01-09 20:54:44
prabhat236218: 2017-12-16 11:52:03

There is a new line after every test case in the input. how we can do this in java

byndz1: 2017-10-25 19:54:38

AC in one go

Last edit: 2017-10-25 19:55:05
imperfectboy: 2017-09-09 09:52:35

getting WA !! but correct ans for all spojtoolkit and comment test cases !! any special test case ????

shubham_1811: 2017-09-04 18:57:54

AC in second:-)
take care if your are using [spoiler]

Last edit: 2018-08-22 16:02:18
deepak_d14: 2017-09-01 08:35:19

That felling when you see green tick :)

anurag_tangri: 2017-07-12 15:07:04

AC :D VERY HAPPY :)

rraj001: 2017-05-21 06:13:17

Good [spoiler] question!

Last edit: 2017-08-02 12:52:01
Siddharth: 2017-04-07 20:15:09

There is some problem for python codes since the same code worked in C++.

trump5377: 2017-03-31 11:44:22

AC in one go...


Added by:cegprakash
Date:2011-12-25
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64