#P4727. [HNOI2009] 图的同构计数

    ID: 3667 远端评测题 2000ms 125MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>数学2009各省省选湖南群论置换Polya原理逆元

[HNOI2009] 图的同构计数

Description

After learning the above, Xiaoxue felt that directly challenging the ultimate problem was still quite difficult, so he decided to start with simpler problems. Specifically, he became very interested in the graph isomorphism problem. Graph AA and graph BB are considered isomorphic if, after relabeling the vertices of graph AA in some way, the vertex set and edge set of AA correspond exactly one-to-one with those of BB.

Xiaoxue is now focused on how to determine whether two graphs are isomorphic. At the same time, he also wants to know how many pairwise non-isomorphic graphs with NN vertices there are. It is well known that a simple graph with NN vertices has at most N×(N1)/2N\times(N-1)/2 edges, so there are 2N×(N1)/22^{N\times(N-1)/2} possible graphs with NN vertices. Clearly, many of these graphs are isomorphic. What Xiaoxue wants to know is: if we count isomorphic graphs as one, how many different graphs are there? He threw this task to you—solve it quickly before he figures it out!

Input Format

The input contains a non-negative integer NN, representing the number of vertices of the graph, and 0N600 \leq N \leq 60.

Output Format

Output one integer, representing the number of graphs with NN vertices that are non-isomorphic under isomorphism. Since the answer may be very large, output the final result mod 997\bmod ~ 997 (997997 is a prime).

1
1
2
2
3
4
5
34
9
493

Hint

For 40%40\% of the testdata, N20N \le 20.
For 100%100\% of the testdata, 0N600 \le N \le 60.

Translated by ChatGPT 5