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

24719번 - Dijamant 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB189952.941%

문제

Lovro has a table of $n$ rows and $m$ columns, where each cell is either . or #. By rotating a square by 45 a diamond shape is formed in the table. For a part of the table to be considered a diamond, its edge must also consist only of the character #, while its inside must be completely filled with . and it must be nonempty. Outside of a diamond any character is allowed. Diamonds come in different sizes, and the three smallest examples of a diamond are shown in the first sample.

Fabijan asked Lovro to tell him how many diamonds are there in the table, or else Lovro has to give him a cookie. Help Lovro by writing a program which counts the number of diamonds in his table.

입력

The first line contains positive integers $n$ and $m$ (1ドル ≤ n, m ≤ 2000$), the number of rows and columns. Each of the next $n$ lines contains $m$ characters . or # which describe the table.

출력

In the only line print the number of diamonds in the table.

제한

서브태스크

번호배점제한
120

1ドル ≤ n, m ≤ 100$

250

No additional constraints.

예제 입력 1

7 25
.#...#....#....#.....#...
#.#..#...#.#...#....#.#..
.#...#..#...#..#...#...#.
.....#...#.#...#..#.....#
.....#....#....#...#...#.
.....#.........#....#.#..
.....#.........#.....#...

예제 출력 1

3

예제 입력 2

11 17
.....#........#..
....#.#........#.
...#...#....#...#
..#.....#....#.#.
.#....#..#....#..
#....#.#..#......
.#....#..#.......
..#.....#........
...#...#.........
....#.#..........
.....#...........

예제 출력 2

1

예제 입력 3

5 11
##.#.#.#.##
#.#.#.#.#.#
.#.#.#.#.#.
#.#.#.#.#.#
##.#.#.#.##

예제 출력 3

14

힌트

Clarification of the second example:

There is only one diamond in the table (the one with the smallest possible size). There appears to be another diamond containing it, but it is not considered a diamond because its inside is not completely filled with '.'. The shape on the right side of the table is also not a diamond because it’s missing a # character on its edge.

출처

Contest > Croatian Open Competition in Informatics > COCI 2021/2022 > Contest #5 2번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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