[COCI 2021/2022 #5] Dijamant

Luogu
IDLGP8325
Time1000ms
Memory512MB
DifficultyP3
2021COCI(克罗地亚)
桌上摆放有若干颗『钻石』。 当一个正方形旋转 $45^\circ$ 时,它就形成了『菱形』的形状。规定外形形如『菱形』且外边框均为 $\texttt \#$ 但内部均为 $\texttt .$ 的图形为一颗『钻石』。 给定一个 $n \times m$ 大小的桌面,统计桌上摆放有多少颗『钻石』。 ## Input 第一行两个正整数 $n,m$,表示桌面的大小。 接下来的 $n$ 行,每行 $m$ 个字符 $\texttt \#$ 或 $\texttt .$,表示桌面。 ## Output 『钻石』的数量。 [samples] ## Note **【样例 2 解释】** 看起来好像有 $3$ 颗,但实际上有两个『菱形』互相包含,因此不符合『外边框均为 $\texttt \#$ 但内部均为 $\texttt .$』的定义。故只有 $1$ 颗『钻石』。 **【数据规模与约定】** **本题采用捆绑测试。** - Subtask 1(20 pts):$1 \le n,m \le 100$。 - Subtask 2(50 pts):无特殊限制。 对于 $100\%$ 的数据,$1 \le n,m \le 2000$。 **【来源】[COCI 2021-2022#5](https://hsin.hr/coci/contest5_tasks.pdf) Task 2 Dijamant。**
Samples
Input #1
7 25
.#...#....#....#.....#...
#.#..#...#.#...#....#.#..
.#...#..#...#..#...#...#.
.....#...#.#...#..#.....#
.....#....#....#...#...#.
.....#.........#....#.#..
.....#.........#.....#...
Output #1
3
Input #2
11 17
.....#........#..
....#.#........#.
...#...#....#...#
..#.....#....#.#.
.#....#..#....#..
#....#.#..#......
.#....#..#.......
..#.....#........
...#...#.........
....#.#..........
.....#...........
Output #2
1
Input #3
5 11
##.#.#.#.##
#.#.#.#.#.#
.#.#.#.#.#.
#.#.#.#.#.#
##.#.#.#.##
Output #3
14
API Response (JSON)
{
  "problem": {
    "name": "[COCI 2021/2022 #5] Dijamant",
    "description": {
      "content": "桌上摆放有若干颗『钻石』。 当一个正方形旋转 $45^\\circ$ 时,它就形成了『菱形』的形状。规定外形形如『菱形』且外边框均为 $\\texttt \\#$ 但内部均为 $\\texttt .$ 的图形为一颗『钻石』。 给定一个 $n \\times m$ 大小的桌面,统计桌上摆放有多少颗『钻石』。",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 524288
    },
    "difficulty": {
      "LuoguStyle": "P3"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGP8325"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "桌上摆放有若干颗『钻石』。\n\n当一个正方形旋转 $45^\\circ$ 时,它就形成了『菱形』的形状。规定外形形如『菱形』且外边框均为 $\\texttt \\#$ 但内部均为 $\\texttt .$ 的图形为一颗『钻石』。\n\n给定一个 $n \\times m$ 大小的桌面,统计桌上摆放有多少颗『钻石』。\n\n## Input\n\n第一行两个正整数 $n,m$,表示桌面的大小。\n\n接下来的 $n$ 行,每行...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments