| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 67 | 40 | 35 | 59.322% |
You have a given picture with size $w \times h$. Determine if the given picture has a single "+" shape or not. A "+" shape is described below:
+" shape has one center nonempty cell.Find out if the given picture has single "+" shape.
The first line contains two integers $h$ and $w$ (1ドル \le h,ドル $w \le 500$) --- the height and width of the picture.
The $i$-th of the next $h$ lines contains string $s_{i}$ of length $w$ consisting "." and "*" where "." denotes the empty space and "*" denotes the non-empty space.
If the given picture satisfies all conditions, print "YES". Otherwise, print "NO".
5 6 ...... ..*... .****. ..*... ..*...
YES
3 5 ..*.. ****. .*...
NO
7 7 ....... ...*... ..****. ...*... ...*... ....... .*.....
NO
5 6 ..**.. ..**.. ****** ..**.. ..**..
NO
3 7 .*...*. ***.*** .*...*.
NO
5 10 .......... ..*....... .*.******. ..*....... ..........
NO
In the first example, the given picture contains one "+".
In the second example, two vertical branches are located in a different column.
In the third example, there is a dot outside of the shape.
In the fourth example, the width of the two vertical branches is 2ドル$.
In the fifth example, there are two shapes.
In the sixth example, there is an empty space inside of the shape.
Contest > Codeforces > Codeforces Round 566 (Div. 2) B번