#K69522. Marathon Path Connectivity Check
Marathon Path Connectivity Check
Marathon Path Connectivity Check
A city is organizing a marathon and has designated a track on a grid. The track is marked with the '+' character. Due to maintenance and other restrictions, the track might inadvertently split into several disconnected parts.
Your task is to determine if the grid contains more than one connected component of the '+' cells. Formally, if we denote the number of connected regions of '+' cells as \(c\), then the answer is "Yes" if \(c > 1\) and "No" otherwise.
Two cells are considered connected if they are adjacent horizontally or vertically. Note that cells outside the grid boundaries are not considered.
inputFormat
The first line of input contains two integers \(n\) and \(m\) representing the number of rows and columns of the grid, respectively.
This is followed by \(n\) lines, each containing a string of length \(m\), representing the grid. Each character in the grid is either '+' (indicating part of the track) or '.' (indicating an empty cell).
outputFormat
Output a single line containing either "Yes" or "No". Output "Yes" if there is more than one disconnected part (i.e. connected component) of '+' cells; otherwise, output "No".
## sample4 5
++.++
..+..
...+.
.....
Yes
</p>