問題一覧 > 通常問題

No.2214 Products on Tree

レベル : / AI推定難易度 : 1700 / 実行時間制限 : 1ケース 3.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 64
作問者 : Shirotsume / テスター : nok0 ygussany
お気に入りにしたユーザー ProblemId : 8884 / 自分の提出
問題文最終更新日: 2023-02-10 03:38:14
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 376 (順位表) の他の問題:

Problem Statement

There is an undirected tree with $N$ vertices. The vertices are numbered $1, 2, \dots, N$, and the $i$-th edge connects vertices $A_i$ and $B_i$. Consider a graph $G$ obtained by removing $0$ or more edges from this tree.

Suppose that the graph $G$ consists of $k$ connected components, and the numbers of vertices in the connected components are $V_1, V_2, \dots, V_k$. Then, the score of $G$ is defined as $\displaystyle \prod_{i = 1}^{k} V_i$.

There are $2^{N-1}$ possibilities for $G$. Find the sum of the scores over all of them, modulo $998244353$.

Constraints

  • All input values are integers.
  • $2 \leq N \leq 2 \times 10^5$
  • $1 \leq A_i < B_i \leq N$
  • The given graph is a tree.

Input

The input is given from standard input in the following format.

$N$
$A_1$ $B_1$
$A_2$ $B_2$
$\vdots$
$A_{N-1}$ $B_{N-1}$

Output

Print the answer modulo $998244353$.

Sample

Sample 1
Input
3
1 2
1 3
Output
8

There are $2$ edges, so there are $4$ possibilities for $G$. For example, in the graph obtained by removing only edge $1$, there are connected components consisting of $1$ vertex and of $2$ vertices, $1$ of each, so the score is $1 \times 2 = 2$. The score of the graph obtained by removing all edges is $1 \times 1 \times 1 = 1$.

The sum of the scores over the $4$ possibilities is $3 + 2 + 2 + 1 = 8$.

Sample 2
Input
6
2 6
2 5
2 3
3 4
1 6
Output
135
Sample 3
Input
15
7 14
6 15
1 2
3 14
7 8
7 12
9 14
5 8
8 11
6 8
1 7
4 12
5 10
13 15
Output
521280

Print the remainder when divided by $998244353$.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。