Survey
Time limit1sMemory limit512 MB
Split a budget of m dollars into n nonnegative shares, assigned to members at random, to maximize the expected number of members whose threshold is met.
- Level
Medium6 of 10
- Topics
- Dynamic programming, Sorting, Math
- Solved
- No attempts yet
Problem
You are running a survey and want to find respondents in your social group. The group has members, and you have a budget of dollars. Divide the dollars into shares. Each member receives one of the shares, chosen uniformly at random. Each share can be any non-negative real number.
Each person has a reward threshold . A person participates in the survey if and only if they receive a share of at least dollars. Otherwise, they accept the payment and do not participate.
Divide the budget so that the expected number of participating members is as large as possible.
Input
The first line contains two integers () and (), the number of group members and the budget.
The second line contains integers (), the reward threshold of each member.
Output
Print one real number: the maximum expected number of members who participate. An answer is accepted if its absolute or relative error is at most .