Universal Cup Judging System

Universal Cup

시간 제한: 1.0 s 메모리 제한: 512 MB 총점: 100 해킹 가능 ✓
통계

月读世界正在举办一场抽奖活动。

奖池中共有 $n$ 件物品,它们的价值分别为 $A_1, A_2, \dots, A_n$。

辉夜可以参加若干轮抽奖,但她至少需要参加一轮。在每一轮中,流程如下:

  1. 辉夜需要支付当前的抽奖费用 $c$,然后系统会从 $[1, n]$ 中均匀随机地选择一个整数 $x$。她会得知抽中了哪一件物品 $x$。
  2. 看到结果后,辉夜有两种选择:
    • 保留第 $x$ 件物品并结束整个抽奖活动。在这种情况下,她将获得价值为 $A_x$ 的物品。
    • 放弃当前抽中的物品并进入下一轮抽奖。但是,抽奖费用会相应增加,下一轮的费用将变为 $c + k$,即更新 $c \leftarrow c + k$。

辉夜将本次抽奖活动的“收益”定义为最终获得的物品价值 $A_x$ 减去她在所有轮次中支付的抽奖费用之和。

假设辉夜足够聪明,总是采取最优策略来最大化她的期望收益,请求出在最优策略下她能获得的期望收益。

输入格式

第一行包含三个整数 $n, c, k$ ($1 \le n \le 4 \times 10^5, 1 \le c \le 4 \times 10^5, 0 \le k \le 4 \times 10^5$),分别表示奖池中的物品总数、第一轮抽奖的初始费用,以及每次重抽增加的费用。

第二行包含 $n$ 个整数 $A_1, A_2, \dots, A_n$ ($1 \le A_i \le 4 \times 10^5$),表示每件物品的价值。

输出格式

输出一行,包含一个实数,表示辉夜在最优策略下的期望收益。当且仅当你的答案与标准答案之间的绝对误差或相对误差不超过 $10^{-6}$ 时,你的答案才会被视为正确。

样例

样例输入 1

3 2 0
4 1 6

样例输出 1

2.000000000

样例输入 2

9 8 2
53 71 5 6 80 37 50 33 90

样例输出 2

51.557786840

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.