AtCoder Beginner Contest 281
翻译中…
Problem Statement
翻译中…
You are given positive integers $N$ and $M$.
Find the number, modulo $M$, of simple connected undirected graphs with $N$ vertices numbered $1, \dots, N$ that satisfy the following condition.
翻译中…
- For every
$u = 2, \dots, N-1$, the shortest distance from vertex$1$to vertex$u$is strictly smaller than the shortest distance from vertex$1$to vertex$N$.
翻译中…
Here, the shortest distance from vertex $u$ to vertex $v$ is the minimum number of edges in a simple path connecting vertices $u$ and $v$.
Two graphs are considered different if and only if there are two vertices $u$ and $v$ that are connected by an edge in exactly one of those graphs.
翻译中…
Constraints
翻译中…
$3 \leq N \leq 500$$10^8 \leq M \leq 10^9$$N$and$M$are integers.
翻译中…
Input
翻译中…
The input is given from Standard Input in the following format:
翻译中…
N M
翻译中…
Output
翻译中…
Print the answer.
翻译中…
样例
Input #1
4 1000000000
Output #1
8
The following eight graphs satisfy the condition.

Input #2
3 100000000
Output #2
1
Input #3
500 987654321
Output #3
610860515
Be sure to find the number modulo $M$.
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。