atcoder#ABC284H. [ABC284Ex] Count Unlabeled Graphs
[ABC284Ex] Count Unlabeled Graphs
Score : points
Problem Statement
You are to generate a graph by the following procedure.
- Choose a simple undirected graph with unlabeled vertices.
- Write a positive integer at most in each vertex in the graph. Here, there must not be a positive integer at most that is not written in any vertex.
Find the number of possible graphs that can be obtained, modulo . ( is a prime.)
Two graphs are considered the same if and only if one can label the vertices in each graph as to satisfy the following conditions.
- For every such that , the numbers written in vertex in the two graphs are the same.
- For every and such that , there is an edge between and in one of the graphs if and only if there is an edge between and in the other graph.
Constraints
- is a prime.
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
3 1 998244353
4
The following four graphs satisfy the condition.
3 2 998244353
12
The following graphs satisfy the condition.
5 5 998244353
1024
30 15 202300013
62712469