QOJ.ac

QOJ

実行時間制限: 3 s メモリ制限: 2048 MB 満点: 100

#7654. 宇宙通勤

統計

很久以前,在遥远的银河系中,星际通道公司(ICPC)运营着一套复杂的轻轨铁路系统。每个星球恰好有一个火车站,每条轻轨连接银河系中两个不同的星球,并在它们之间往返。最近,星际通道公司建立了一个传送系统,目前正处于测试阶段。现在,一些火车站增设了虫洞。所有的虫洞彼此相连,可以瞬间从一个虫洞传送到另一个虫洞。为了不使新系统超负荷,银河系的每位公民每天最多只能使用一次传送。

Charlie 住在 Gallifrey 星球,在 Sontar 星球工作。今天是她第一天上班,但因为她那该死的闹钟没响,她已经迟到得非常严重了。更糟糕的是,传送系统今天偏偏出了故障,无法选择目的地虫洞。相反,进入虫洞后,人会被随机传送到除当前虫洞外的其他任意一个虫洞(概率均等)。(传送后不可能停留在同一个火车站。)

尽管运气不佳,Charlie 还是决心准时赶去上班。由于所有的轻轨都很慢,她希望乘坐尽可能少的轻轨。如果她最多可以使用一次(故障的)传送系统,那么她去上班所需乘坐轻轨次数的期望值是多少?

Gallifrey 上空的虫洞,mau_king

输入格式

输入包含: 第一行包含整数 $n, m, k$ ($2 \le n \le 2 \cdot 10^5, n - 1 \le m \le 10^6, 2 \le k \le n$),分别表示银河系中的星球数量、轻轨数量和虫洞数量。星球 $1$ 是 Charlie 的家乡 Gallifrey,星球 $n$ 是 Charlie 工作的 Sontar。 第二行包含 $k$ 个不同的整数,表示拥有虫洞的火车站所在的星球(除了轻轨之外)。 * $m$ 行,每行包含两个整数 $a$ 和 $b$ ($1 \le a, b \le n$ 且 $a \neq b$),描述连接星球 $a$ 和 $b$ 的一条轻轨。保证所有轻轨是两两不同的。

保证仅使用轻轨可以从银河系中的任何一个星球到达其他任何星球。

输出格式

输出一个最简分数,表示如果 Charlie 最多可以使用一次(故障的)传送系统,她去上班所需乘坐轻轨次数的期望值。将分数输出为 “a/b” 的形式,其中 $a$ 是分子,$b$ 是分母。

样例

样例输入 1

5 5 3
2 3 4
1 2
1 3
2 4
3 4
4 5

样例输出 1

5/2

样例输入 2

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

样例输出 2

2/1

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.