AtCoder Beginner Contest 419
G
Count Simple Paths 2
AtCoder
⌀ 2677
原题
翻译中…

Problem Statement

翻译中…

You are given a simple connected undirected graph with $N$ vertices numbered $1$ to $N$ and $M$ edges. The $i$-th edge connects vertices $u_i$ and $v_i$.

翻译中…

For each $k=1,2,\ldots,N-1$, find the number of simple paths from vertex $1$ to vertex $N$ that contain exactly $k$ edges.

翻译中…

Constraints

翻译中…
  • $2\leq N\leq 2\times 10^5$
  • $N-1\leq M\leq N+20$
  • $1\leq u_i\lt v_i\leq N$
  • The given graph is a simple connected undirected graph.
  • All input values are integers.
翻译中…

Input

翻译中…

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

翻译中…

N M
u_1 v_1
u_2 v_2
\vdots
u_M v_M

翻译中…

Output

翻译中…

Output the answers in the following format:

翻译中…

\mathrm{ans}_1 \mathrm{ans}_2 \ldots \mathrm{ans}_{N-1}

翻译中…

$\mathrm{ans}_i$ is the number of simple paths from vertex $1$ to vertex $N$ that contain exactly $i$ edges.

翻译中…

样例

Input #1
5 6
1 2
1 3
2 4
3 4
3 5
4 5
Output #1
0 1 2 1
For each $k=1,2,3,4$, the simple paths from vertex $1$ to vertex $5$ that contain exactly $k$ edges are as follows. - $k=1$ : None - $k=2$ : $1\to 3\to 5$ - $k=3$ : $1\to 2\to 4\to 5$ and $1\to 3\to 4\to 5$ - $k=4$ : $1\to 2\to 4\to 3\to 5$
Input #2
11 15
1 2
1 3
2 3
3 4
3 5
4 5
5 6
5 7
6 7
7 8
7 9
8 9
9 10
9 11
10 11
Output #2
0 0 0 0 1 5 10 10 5 1
Input #3
7 18
6 7
4 5
1 7
2 7
1 4
2 5
4 6
2 3
5 6
5 7
1 5
2 4
2 6
1 2
1 3
3 4
1 6
3 5
Output #3
1 3 11 29 50 42
题目信息
题号
abc419_g
时间限制
4 s
内存限制
1024 MB

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