問題一覧 > 通常問題

No.3315 FPS Game

レベル : / AI推定難易度 : 2050 / 実行時間制限 : 1ケース 3.250秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 20
作問者 : 👑 ArcAki / テスター : Blue_S kidodesu 👑 p-adic
お気に入りにしたユーザー ProblemId : 11915 / 自分の提出
問題文最終更新日: 2025-10-24 15: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 486 オムニバス (順位表) の他の問題:

Problem Statement

Aki is playing a certain FPS (First Person Shooter) game.
First, a tree with $N$ vertices is given, where edge $i$ connects vertex $U_i$ and vertex $V_i$.
In this game, edge $i$ corresponds to stage $i$ of the game, and the game starts from stage $S$.
Aki can clear each stage in exactly $1$ minute, and after clearing it, can move to a stage corresponding to an edge that shares one vertex with the edge of the current stage.
However, a stage that has been cleared once becomes locked and can never be visited again during $1$ game.
Aki wants to clear stage $T$.
For each integer $k$ such that $1 ≤ k ≤ N$, find the number of ways to clear stage $T$ in a total of $k$ minutes, modulo $998244353$.
Two ways of clearing are distinguished if and only if their total times differ, or the stages being played differ at some point in time after the start.
The play time includes only the time taken to clear each stage.

Input

$N\ S\ T$
$U_1\ V_1$
$\vdots$
$U_{N-1}\ V_{N-1}$

  • All inputs are integers.
  • $3 ≤ N ≤ 10^5$
  • $1 ≤ S < T ≤ N-1$
  • $1 ≤ U_i < V_i ≤ N$
  • The given graph is a tree.

Output

Output the answers for $k = 1,\ 2,\ …,\ N$ in order on $1$ line, separated by single spaces, followed by a newline at the end.

Sample

Sample 1
Input
6 1 3
1 2
2 3
3 4
2 5
3 6
Output
0 0 1 2 1 0

In this game, the ways to start from stage $1$ and clear stage $3$ are the following $4$ ways, in order from shortest.

  • $1 → 2 → 3$
  • $1 → 4 → 2 → 3$
  • $1 → 2 → 5 → 3$
  • $1 → 4 → 2 → 5 → 3$
Therefore, the answers for each $k$ are $0,\ 0,\ 1,\ 2,\ 1,\ 0$, respectively. Do not forget to take the remainder modulo $998244353$.

Sample 2
Input
8 2 7
1 5
5 8
5 7
3 5
2 5
5 6
4 5
Output
0 1 5 20 60 120 120 0

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