#P7615. [COCI 2011/2012 #2] OKRET
[COCI 2011/2012 #2] OKRET
Description
You are given an map, where . means the cell is walkable and X means the cell is not walkable. Determine whether the map contains any dead ends.
A cell is a dead end if among its four neighboring cells (up, down, left, right), only one cell is walkable. Of course, you cannot move outside the map.
Input Format
The first line contains two positive integers .
The next lines each contain characters describing the map.
Output Format
If the map contains a dead end, output ; otherwise, output .
4 3
XXX
X.X
X.X
XXX
1
5 5
XX.XX
X...X
.....
X...X
XX.XX
1
3 9
...XXX...
.X.....X.
...XXX...
0
Hint
Constraints
For of the testdata, .
Notes
The score of this problem follows the original COCI settings, with a maximum of points.
Translated from COCI2011-2012 CONTEST #2 T2 OKRET.
Translated by ChatGPT 5
京公网安备 11011102002149号