# Answer to Question #60946 in Java | JSP | JSF for sangeetha

Question #60946

Given a square maze (A) of dimension N, every entry (Aij) in the maze is either an open cell 'O' or a wall 'X'. A rat can travel to its adjacent locations (left, right, top and bottom), but to reach a cell, it must be open. Given the locations of Rrats, can you find out whether all the rats can reach others or not?

Input Format:

Input will consist of three parts, viz.

1. Size of the maze (N)

2. The maze itself (A = N * N)

3. Number of rats (R)

4. Location of R rats (Xi, Yi)

Note:

(Xi,Yi) will represents the location of the i-th rat.

Locations are 1-index based.

Output Format:

Print "Yes" if the rats can reach each other, else print "No"

Constraints:

1<=N<=350

Aij = {'O','X'}

1<=R<=N*N

1<=Xi<=N

1<=Yi<=N

Input Format:

Input will consist of three parts, viz.

1. Size of the maze (N)

2. The maze itself (A = N * N)

3. Number of rats (R)

4. Location of R rats (Xi, Yi)

Note:

(Xi,Yi) will represents the location of the i-th rat.

Locations are 1-index based.

Output Format:

Print "Yes" if the rats can reach each other, else print "No"

Constraints:

1<=N<=350

Aij = {'O','X'}

1<=R<=N*N

1<=Xi<=N

1<=Yi<=N

Expert's answer

Dear sangeetha, your question requires a lot of work, which neither of our experts is ready to perform for free. We advise you to convert it to a fully qualified order and we will try to help you. Please click the link below to proceed:

**Submit order**Need a fast expert's response?

Submit orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment