QOJ.ac

QOJ

実行時間制限: 2 s メモリ制限: 512 MB 満点: 100

#2878. 雾中旅途

統計

Julia 和 Jane 是住在一条长为 $L$ 的狭长街道两端的好友。 今天,Julia 需要去见 Jane 并尽快回到家中。

Jane 有一个速度列表 $v_1, v_2, \dots, v_n$。在时间 $0$ 时,Jane 会从 $1$ 到 $n$ 中等概率随机选择一个整数 $i$,并以恒定速度 $v_i$ 向 Julia 移动。

Julia 的行动则不受此限制。从时间 $0$ 开始,Julia 可以以不超过 $V$ 的任意速度在街道上向任意方向自由移动。特别地,Julia 可以根据需要原地停留、以低于 $V$ 的速度移动,或在任何时刻改变速度。

外面雾很大,因此 Julia 和 Jane 只有在街道上的同一位置时才能看到对方。此外,Julia 不知道 Jane 的具体速度,但她知道速度列表 $v_1, v_2, \dots, v_n$。

假设 Julia 与 Jane 会合并回到家中总共花费的时间为 $t$。Julia 将采取一种策略以最小化 $t$ 的期望值。请计算该期望值。

输入格式

第一行包含三个整数 $n, L$ 和 $V$ —— Jane 的速度列表长度、街道长度以及 Julia 的最大速度 ($1 \le n \le 10^5; 1 \le L \le 10^9; 1 \le V \le 10^6$)。

第二行包含 $n$ 个整数 $v_1, v_2, \dots, v_n$ —— Jane 可能的速度列表,按升序排列 ($1 \le v_1 < v_2 < \dots < v_n \le 10^6$)。

输出格式

输出一个实数 —— 若 Julia 采取最优策略,她与 Jane 会合并回到家中所需时间的期望值。如果你的答案的绝对误差或相对误差不超过 $10^{-9}$,则视为正确。

样例

样例输入 1

1 1000 30
10

样例输出 1

50.0000000000000

样例输入 2

1 1000 10
30

样例输出 2

33.3333333333333

样例输入 3

4 1000 20
10 20 30 40

样例输出 3

46.2500000000000

说明

在第一个样例中,Julia 比 Jane 快得多。Julia 最优的策略是以最快速度向 Jane 移动,在时间 $25$ 时于距离家 $750$ 的位置与她会合,并在时间 $50$ 时回到家中。

在第二个样例中,Jane 比 Julia 快得多。Julia 最优的策略是在家中等待 Jane,Jane 将在时间 $\frac{1000}{30}$ 时到达。

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.