PivotOJ

Graduation Guarantee

시간 제한: 1000ms메모리 제한: 1024MB출처: NCPC 2022BOJ 26030

문제

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 nn yes/no questions. Answering correctly gives +1+1 point, answering incorrectly gives 1-1 point, and not answering gives 00 points. To pass the exam, at least kk points are needed. For each question, Gustav has a guess that he knows is correct with probability pip_i (0.5pi10.5 \leq p_i \leq 1). Note that pi0.5p_i \geq 0.5, because otherwise guessing the opposite would be better.

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.

입력

The first line contains the two integers nn and kk (1kn50001 \leq k \leq n \leq 5000). The second line contains nn real numbers pip_i (0.5pi1.00.5 \leq p_i \leq 1.0). These numbers will have at most 66 digits after the decimal point.

출력

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 10610^{-6}.

예제

예제 1

입력
3 3
0.5 0.5 0.5
출력
0.125

예제 2

입력
4 1
0.9 0.5 0.9 0.9
출력
0.972
코드를 제출하려면 로그인하세요.