B. 迷宫寻路

    Type: Default 1000ms 256MiB

迷宫寻路

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Background

Special for beginners, ^_^

Description

机器猫被困在一个矩形迷宫里。

迷宫可以视为一个 n×m 矩阵,每个位置要么是空地,要么是墙。机器猫只能从一个空地走到其上、下、左、右的空地。

机器猫初始时位于 (1,1) 的位置,问能否走到 (n,m) 位置。

Format

Input

第一行,两个正整数 n,m。

接下来 n 行,输入这个迷宫。每行输入一个长为 m 的字符串,# 表示墙,. 表示空地。

Output

仅一行,一个字符串。如果机器猫能走到 (n,m),则输出 Yes;否则输出 No。

Samples

3 5
.##.#
.#...
...#.
Yes

Limitation

对于 100% 的数据,保证 1≤n,m≤100,且 (1,1) 和 (n,m) 均为空地

11月15日题目单

Not Attended
Status
Done
Rule
IOI
Problem
3
Start at
2025-11-10 14:00
End at
2025-11-20 14:00
Duration
240 hour(s)
Host
Partic.
33