Universal Cup Judging System

Universal Cup

时间限制: 1.0 s 内存限制: 512 MB 总分: 100 可 Hack ✓
统计

ツクヨミで抽選イベントが開催されています。

賞品プールには $n$ 個のアイテムがあり、それぞれの価値は $A_1, A_2, \dots, A_n$ です。

かぐやは何ラウンドでも抽選に参加できますが、少なくとも 1 ラウンドは参加しなければなりません。各ラウンドの手順は以下の通りです:

  1. かぐやは現在の抽選費用 $c$ を支払い、その後 $[1, n]$ から一様ランダムに整数 $x$ が選ばれます。彼女はどのアイテム $x$ が当たったかを知ります。
  2. 結果を見た後、かぐやには 2 つの選択肢があります:
    • $x$ 番目のアイテムを受け取り、抽選イベント全体を終了する。この場合、彼女は価値 $A_x$ のアイテムを手に入れます。
    • 現在当たったアイテムを諦めて、次のラウンドの抽選に進む。ただし、抽選費用はそれに応じて増加し、次のラウンドの費用は $c + k$ になります(つまり $c \leftarrow c + k$ と更新されます)。

かぐやは、この抽選イベントの「利益」を、最終的に手に入れたアイテムの価値 $A_x$ から、全ラウンドで支払った抽選費用の合計を引いたものとして定義します。

かぐやが十分に賢く、期待利益を最大化する最適戦略を常に取ると仮定したとき、最適戦略のもとで彼女が得ることのできる期待利益を求めてください。

入力

1 行目には、賞品プール内のアイテムの総数、最初の抽選ラウンドの初期費用、および引き直しごとの費用の増加分を表す 3 つの整数 $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$) が与えられます。

2 行目には、各アイテムの価値を表す $n$ 個の整数 $A_1, A_2, \dots, A_n$ ($1 \le A_i \le 4 \times 10^5$) が与えられます。

出力

かぐやの最適戦略のもとでの期待利益を表す実数を 1 行に出力してください。あなたの答えと想定解との絶対誤差または相対誤差が $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.