QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 512 MB Points totaux : 100

#781. Three Thousand Worlds

Statistiques

For a set $S$ of paths on a tree, define $f(S)$ as the size of the largest subset $T \subseteq S$ such that all paths in $T$ are vertex-disjoint. We consider a pair $(x, y)$ to represent a path. For the set of all paths $P = \{ (x, y) \mid 1 \le x, y \le n \}$, calculate:

$$\sum_{S \subseteq P} f(S)$$

That is, you need to calculate the sum of $f$ values for all $2^{n^2}$ possible sets. You only need to output the result modulo $998244353$.

Input

The first line contains a positive integer $n$, representing the number of nodes in the tree. The next $n - 1$ lines each contain two positive integers $u, v$, representing an edge on the tree.

Output

Output a single integer representing the result modulo $998244353$.

Examples

Input 1

2
1 2

Output 1

19

Note 1

The set with $f$ value 0 is $\emptyset$. For $f$ value 2, the set must contain $(1, 1)$ and $(2, 2)$, while $(1, 2)$ and $(2, 1)$ can be chosen arbitrarily, resulting in 4 such sets. The remaining 11 sets have an $f$ value of 1. Therefore, the answer is $0 \times 1 + 1 \times 11 + 2 \times 4 = 19$.

Input 2

5
1 2
2 3
3 4
4 5

Output 2

103767551

Subtasks

For 100% of the data, $1 \le n \le 5,000$.

Test Case $n$ Special Constraint
1 $= 2$
2 $= 3$
3 $= 4$
4 $= 5$
5, 6 $= 200$
7 $= 5,000$ A
8 $= 5,000$ B
9, 10 $= 5,000$

Special constraints: A represents the edge set $\{(1, 2), (2, 3), \dots, (n - 1, n)\}$. B represents the edge set $\{(1, 2), (1, 3), \dots, (1, n)\}$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.