Universal Cup Judging System

Universal Cup

Limite de temps : 3.0 s Limite de mémoire : 1024 MB Points totaux : 100 Hackable ✓
Statistiques

Astana 地铁的修建方式与众不同。

建城后的第一年,市中心修建了一座编号为 1 的车站。此后每一年 $v$,市长都会从已经过去的年份中选择一个 $p$,满足 $1 \le p < v$,并下令修建一座新车站,铺设轨道连接到第 $p$ 年建成的车站。列车在这条轨道上只能从新车站驶向中心。

因此,地铁始终是一棵树,并且从任何车站都只能朝中心车站行驶,而从中心车站则无路可走。无法从其他车站到达的车站称为终端车站。

按照历史定义,车站 $v$ 的换乘复杂度是能够通过一条轨道到达 $v$ 的车站数量。不过,终端车站的换乘复杂度为 1。

Astana 建城至今已有 $n$ 年,因此地铁现在有 $n$ 座车站。

今年,市长宣布,此后每一年新轨道连接到哪座车站,都将在所有已建成的车站中均匀随机选择。

Pupa 计划在 $m$ 年后前往 Astana 旅游,那时将有 $n + m$ 座车站。市长将以这种随机方式修建这 $m$ 座新车站。根据观光计划,Pupa 将乘坐一次地铁:她会从所有终端车站中均匀随机选择一座,朝中心方向行驶,并在中心车站下车。Pupa 还会购买一本列有所有车站及其换乘复杂度的纸质指南。她会在指南中划掉自己经过的每一座车站(包括路径的起点和终点)。

乘车后,Pupa 计划将指南中所有未被划掉的车站的换乘复杂度相乘——这个乘积就是她此次旅行的结果。如果她划掉了所有车站,那么此次旅行的结果为 1。

请帮助 Pupa 求出她此次旅行结果的期望值,对 $998\,244\,353$ 取模。

输入格式

第一行包含两个整数 $n, m$($2 \le n \le 200$,$1 \le m \le 200$),分别表示地铁当前的车站数,以及 Pupa 在多少年后到达 Astana。

第二行包含整数 $p_2, \ldots, p_n$($1 \le p_i < i$),表示车站 $2$ 到 $n$ 的轨道连接目标。

输出格式

输出一个数,表示 $m$ 年后 Pupa 此次旅行结果的期望值。答案对 $998\,244\,353$ 取模。

样例

输入格式 1

4 1
1 1 1

输出格式 1

1

样例

输入格式 2

12 2
1 1 2 2 3 3 4 5 6 4 5

输出格式 2

413192725

样例

输入格式 3

2 77
1

输出格式 3

253554867

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#2869EditorialOpenNew Editorial for Problem #20248louyuxuanView

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.