#abc213g. G - Connectivity 2
G - Connectivity 2
Score : points
问题描述
给定一个包含 个顶点和 条边的简单无向图 。顶点编号为 ,边编号为 ,其中第 条边连接顶点 和顶点 。
考虑从 中移除零个或多个边以得到一个新的图 。我们可以得到 种不同的图作为 。在这些图中,对于每个满足 的整数 ,找出顶点 和顶点 直接或间接相连的图的数量。
由于数量可能非常大,将结果对 取模后输出。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Given is a simple undirected graph with vertices and edges. The vertices are numbered , the edges are numbered , and Edge connects Vertex and Vertex .
Consider removing zero or more edges from to get a new graph . There are graphs that we can get as . Among them, find the number of such graphs that Vertex and Vertex are directly or indirectly connected, for each integer such that .
Since the counts may be enormous, print them modulo .
Constraints
- if .
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain the answer for .
Sample Input 1
3 2
1 2
2 3
Sample Output 1
2
1
We can get the following graphs as .
- The graph with no edges. Vertex is disconnected from any other vertex.
- The graph with only the edge connecting Vertex and . Vertex is reachable from Vertex .
- The graph with only the edge connecting Vertex and . Vertex is disconnected from any other vertex.
- The graph with both edges. Vertex and are reachable from Vertex .
Sample Input 2
5 6
1 2
1 4
1 5
2 3
2 5
3 4
Sample Output 2
43
31
37
41
Sample Input 3
2 0
Sample Output 3
0
update @ 2024/3/10 09:30:20