#P2225. [HNOI2001] 棋盘变换

    ID: 1199 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>动态规划,dp2001各省省选湖南最大流费用流

[HNOI2001] 棋盘变换

Description

On an n×nn \times n board, fill each cell with 11 or 1-1. After one transformation, every number in the grid becomes the product of the four numbers that are adjacent to it (up, down, left, and right) before the transformation. For example:

However, some states remain the same before and after the transformation, such as the state where all entries are 11. Such a state is called an invariant state.

Your task is to find all essentially different invariant states (states that become identical after rotations or reflections are considered essentially the same).

Input Format

One line containing a single positive integer nn.

Output Format

One line containing a single positive integer, the number of essentially different invariant states.

4
5

Hint

1n301 \le n \le 30.

Within the given range, the total number of invariant states is <9×103< 9 \times 10^3.

Translated by ChatGPT 5