#abc248f. F - Keep Connect
F - Keep Connect
Score : points
问题描述
给定一个大于等于2的整数 和一个质数 。
考虑下图所示具有2N个顶点和(3N-2)条边的图 。
更具体地说,边连接顶点的方式如下,其中顶点标记为Vertex , Vertex , , Vertex ,边标记为Edge , Edge , , Edge 。
- 对于每个 ,Edge 连接Vertex 和 Vertex 。
- 对于每个 ,Edge 连接Vertex 和 Vertex 。
- 对于每个 ,Edge 连接Vertex 和 Vertex 。
对于 ,解决以下问题。
求在模 下,从 的 条边中恰好移除 条边,使得得到的图仍然保持连通的方法数量。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given an integer greater than or equal to and a prime .
Consider the graph with vertices and edges shown in the figure below.
More specifically, the edges connect the vertices as follows, where the vertices are labeled as Vertex , Vertex , , Vertex , and the edges are labeled as Edge , Edge , , Edge .
- For each , Edge connects Vertex and Vertex .
- For each , Edge connects Vertex and Vertex .
- For each , Edge connects Vertex and Vertex .
For each , solve the following problem.
Find the number of ways, modulo , to remove exactly of the edges of so that the resulting graph is still connected.
Constraints
- is an integer.
- is a prime.
Input
Input is given from Standard Input in the following format:
Output
Print integers, the -th of which is the answer for , separated by spaces.
Sample Input 1
3 998244353
Sample Output 1
7 15
In the case , there are ways, shown below, to remove exactly one edge so that the resulting graph is still connected.
There are ways, shown below, to remove exactly two edges so that the resulting graph is still connected.
Thus, these numbers modulo should be printed: and , in this order.
Sample Input 2
16 999999937
Sample Output 2
46 1016 14288 143044 1079816 6349672 29622112 110569766 330377828 784245480 453609503 38603306 44981526 314279703 408855776
Be sure to print the numbers modulo .
update @ 2024/3/10 10:37:43