Graphs (3)

Write a program that, given a map with goals and obstacles, tells if it is possible to reach any goal from a given initial position. The allowed movements are horizontal or vertical, but not diagonal.

Input

Input begins with the number of rows n>0n > 0 and the number of columns m>0m > 0 of the map. Follow nn rows with mm characters each. A dot indicates an empty position, an ‘X’ indicates an obstacle, and a ‘t’ indicates a goal. Finally, two numbers rr and cc indicate the initial row and column (both of them starting at 1) where we must start looking for goals. You can assume that rr is between 1 and nn, that cc is between 1 and mm, and that the initial position is always empty.

Output

Print “yes” or “not” depending on whether it possible or not to reach any goal.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T10:38:37.541Z

© Jutge.org, 2006–2026.
https://jutge.org