Logo
(追記) (追記ここまで)

30163번 - Plus from Picture 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB67403559.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:

  • A "+" shape has one center nonempty cell.
  • There should be some (at least one) consecutive non-empty cells in each direction (left, right, up, down) from the center. In other words, there should be a ray in each direction.
  • All other cells are empty.

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".

제한

예제 입력 1

5 6
......
..*...
.****.
..*...
..*...

예제 출력 1

YES

예제 입력 2

3 5
..*..
****.
.*...

예제 출력 2

NO

예제 입력 3

7 7
.......
...*...
..****.
...*...
...*...
.......
.*.....

예제 출력 3

NO

예제 입력 4

5 6
..**..
..**..
******
..**..
..**..

예제 출력 4

NO

예제 입력 5

3 7
.*...*.
***.***
.*...*.

예제 출력 5

NO

예제 입력 6

5 10
..........
..*.......
.*.******.
..*.......
..........

예제 출력 6

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번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /