Dijamant
의견: 0
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.
Subtask 1 (20 points): \(1 \le n\), \(m \le 100\)
Subtask 2 (50 points): No additional constraints.
The first line contains positive integers \(n\) and \(m\) (\(1 \le n\), \(m \le 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.
| 서브태스크 | 점수 | 설명 |
|---|---|---|
1 | 20점 | \(1 \le n\), \(m \le 100\) |
2 | 50점 | No additional constraints. |
7 25
.#...#....#....#.....#...
#.#..#...#.#...#....#.#..
.#...#..#...#..#...#...#.
.....#...#.#...#..#.....#
.....#....#....#...#...#.
.....#.........#....#.#..
.....#.........#.....#...
3
11 17
.....#........#..
....#.#........#.
...#...#....#...#
..#.....#....#.#.
.#....#..#....#..
#....#.#..#......
.#....#..#.......
..#.....#........
...#...#.........
....#.#..........
.....#...........
1
5 11
##.#.#.#.##
#.#.#.#.#.#
.#.#.#.#.#.
#.#.#.#.#.#
##.#.#.#.##
14
평가 및 의견
Dijamant
Log in to rate problems.
아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.
풀이 제출
Dijamant