AtCoder Beginner Contest 284
Ex
Count Unlabeled Graphs
AtCoder
⌀ 3125
原题
←G →
翻译中…

Problem Statement

翻译中…

You are to generate a graph by the following procedure.

翻译中…
  • Choose a simple undirected graph with $N$ unlabeled vertices.
  • Write a positive integer at most $K$ in each vertex in the graph. Here, there must not be a positive integer at most $K$ that is not written in any vertex.
翻译中…

Find the number of possible graphs that can be obtained, modulo $P$. ($P$ is a prime.)

翻译中…

Two graphs are considered the same if and only if one can label the vertices in each graph as $v_1, v_2, \dots, v_N$ to satisfy the following conditions.

翻译中…
  • For every $i$ such that $1 \leq i \leq N$, the numbers written in vertex $v_i$ in the two graphs are the same.
  • For every $i$ and $j$ such that $1 \leq i \lt j \leq N$, there is an edge between $v_i$ and $v_j$ in one of the graphs if and only if there is an edge between $v_i$ and $v_j$ in the other graph.
翻译中…

Constraints

翻译中…
  • $1 \leq K \leq N \leq 30$
  • $10^8 \leq P \leq 10^9$
  • $P$ is a prime.
  • All values in the input are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N K P

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
3 1 998244353
Output #1
4
The following four graphs satisfy the condition. ![image](https://img.atcoder.jp/ghi/abc283h_43c4abe0e541b7ebeaa8db2854cece91caeca71f03f452ca13c11e82f85e3a56.png)
Input #2
3 2 998244353
Output #2
12
The following $12$ graphs satisfy the condition. ![image2](https://img.atcoder.jp/ghi/abc284h2_ca96b7cb451b0e495209e3e201576d278de3fb823e5d2404bbce5d9f704e3259.png)
Input #3
5 5 998244353
Output #3
1024
Input #4
30 15 202300013
Output #4
62712469
题目信息
题号
abc284_h
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。