螺旋星系AI (CI翻译)
Problem Statement
题目描述
AI (CI翻译)There is a grid with $H$ rows and $W$ columns. The cell at the $i$-th row from the top and $j$-th column from the left is denoted as cell $(i, j)$.
有一个 $H$ 行 $W$ 列的网格。从上往下数第 $i$ 行、从左往右数第 $j$ 列的单元格记为单元格 $(i, j)$。AI (CI翻译)
Each cell of the grid is colored white or black. The information of the grid is given by $H$ strings $S_1, S_2, \ldots, S_H$ each of length $W$: cell $(i, j)$ is white if the $j$-th character of $S_i$ is ., and black if it is #.
网格中的每个单元格都被涂成白色或黑色。网格的信息由 $H$ 个长度为 $W$ 的字符串 $S_1, S_2, \ldots, S_H$ 给出:如果 $S_i$ 的第 $j$ 个字符是 .,则单元格 $(i, j)$ 为白色;如果是 #,则为黑色。AI (CI翻译)
Find the number of rectangular regions of the grid that are point-symmetrically colored.
请找出网格中着色关于某个点中心对称的矩形区域数量。AI (CI翻译)
More formally, find the number of integer tuples $(h_1, h_2, w_1, w_2)$ satisfying all of the following conditions:
更形式化地说,请求满足以下所有条件的整数四元组 $(h_1, h_2, w_1, w_2)$ 的数量:AI (CI翻译)
$1 \leq h_1 \leq h_2 \leq H$$1 \leq w_1 \leq w_2 \leq W$- For all integers
$i, j$satisfying$h_1 \leq i \leq h_2$and$w_1 \leq j \leq w_2$, cell$(i, j)$and cell$(h_1 + h_2 - i, w_1 + w_2 - j)$have the same color.
$1 \leq h_1 \leq h_2 \leq H$$1 \leq w_1 \leq w_2 \leq W$- 对于所有满足
$h_1 \leq i \leq h_2$且$w_1 \leq j \leq w_2$的整数$i, j$,单元格$(i, j)$与单元格$(h_1 + h_2 - i, w_1 + w_2 - j)$的颜色相同。
Constraints
约束条件
AI (CI翻译)$1 \leq H, W \leq 10$$H$and$W$are integers.$S_i$is a string of length$W$consisting of.and#.
$1 \leq H, W \leq 10$$H$和$W$是整数。$S_i$是一个长度为$W$、仅由.和#组成的字符串。
Input
输入格式
AI (CI翻译)The input is given from Standard Input in the following format:
输入由标准输入给出,格式如下:AI (CI翻译)
H W
S_1
S_2
\vdots
S_H
H W
S_1
S_2
\vdots
S_HAI (CI翻译)
Output
输出格式
AI (CI翻译)Output the answer.
输出答案。AI (CI翻译)
样例
3 2
.#
#.
##
10
4 5
.#.#.
####.
##..#
....#
54
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。