#P16554. [ICPC 2026 LAC] Holes and Tunnels

[ICPC 2026 LAC] Holes and Tunnels

题目描述

Path-Digging Animals (PDA) is a new cooperative game for two players that is gaining popularity among programmers. The game is played on a board having NN holes and N1N-1 bidirectional tunnels. The tunnels form an undirected tree, which means that there is a unique simple path between each pair of holes.

A route in PDA is a simple path between two different holes. Since tunnels are bidirectional, the direction of a route is not relevant: the (unique) route from hole UU to hole VV and the (unique) route from hole VV to hole UU are the same route.

Players use animal-shaped pieces for playing PDA. In each round of the game, each player independently chooses a route which is traversed by their animal, and both players score as many points as the number of tunnels that their routes have in common.

Right now Alicia and Bruno are at a board game party in Chile playing PDA, and they want to analyze their scoring possibilities. They would like to know, for each integer kk from 11 to N1N-1, how many ordered pairs of routes (A,B)(A, B) there are such that Alicia and Bruno score exactly kk points if Alicia chooses route AA and Bruno chooses route BB.

输入格式

The first line contains an integer NN (2N2×1052 \le N \le 2 \times 10^5) indicating the number of holes. Each hole is identified by a distinct integer from 11 to NN.

Each of the next N1N-1 lines contains two integers UU and VV (1U,VN1 \le U, V \le N and UVU \neq V), representing that there is a bidirectional tunnel between holes UU and VV. It is guaranteed that the tunnels form an undirected tree.

输出格式

Output a single line with N1N-1 integers P1,P2,,PN1P_1, P_2, \dots, P_{N-1}, where PkP_k indicates the number of ordered pairs of routes (A,B)(A, B) such that Alicia and Bruno score exactly kk points if Alicia chooses route AA and Bruno chooses route BB. Because these numbers can be very large, output the remainder of dividing each of them by 998244353998244353.

3
1 3
2 3
6 1

提示

Explanation of Sample 1:

There are three possibilities for Alicia's route AA: the route between holes 11 and 33 (formed by the single tunnel between these holes), the route between holes 22 and 33 (again a single tunnel), and the route between holes 22 and 11 (containing both tunnels). The same three possibilities are available for Bruno's route BB. The table below shows the score for each combination. As can be seen, 66 ordered pairs of routes yield a score of 11 point, while 11 pair gives 22 points. Applying the modulo operation does not change these results.

:::align{center} :::