| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 1024 MB | 9 | 2 | 2 | 40.000% |
Consider a tree with a green or blue stone placed at each vertex. Such a tree is called a "Gemini Tree" if condition 3 can be satisfied after performing the following operations 1 and 2.
You are given an $N$-vertex tree with no stones. There are $2^N$ ways to place one stone at each vertex. How many of them satisfy the following condition?
Output the remainder of the answer after dividing by $998244353$ because it can be large.
$N$
$u_1$ $v_1$
$\vdots$
$u_{N-1}$ $v_{N-1}$
Output the remainder of the answer after dividing by $998244353$ in one line. Add a new line at the end of the output.
3 1 2 2 3
8
4 1 2 1 3 1 4
10
7 1 2 1 3 1 4 2 5 2 6 2 7
84
In Sample Input 1, All of the stone placements satisfy the condition.
In Sample Input 2, there are 10 different ways that the first placement is "Gemini Tree." They could also be "Gemini Tree" after one leaf is removed.
In Sample Input 3, there are 86 ways that the first placement is a "Gemini Tree." Two of these are not "Gemini Tree," if any one leaf is removed.