Problem G
Graduation Guarantee

Gustav is studying to become an interpreter. In this line of work, knowing several languages is a must, and Gustav is already fluent in French, Mandarin, Nahuatl and even Finnish. But there is one language that Gustav struggles with: Norwegian. Before Gustav can graduate, he must complete the infamous Norwegian Conclusive Proficiency Check.
This exam consists of
What is the maximum possible probability of passing the exam, assuming we carefully choose which questions to answer and which ones to leave unanswered? Note that unlike a programming contest, the exam does not have instant feedback. So Gustav will answer the questions, hand in his answers, and only later be told the results.
Input
The first line contains the two integers
Output
Output the probability that we pass the exam. Your answer
will be considered correct if it has an absolute or relative
error of at most
Sample Input 1 | Sample Output 1 |
---|---|
3 3 0.5 0.5 0.5 |
0.125 |
Sample Input 2 | Sample Output 2 |
---|---|
4 1 0.9 0.5 0.9 0.9 |
0.972 |