포럼
문제 ICPC00290

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 \(n\) yes/no questions. Answering correctly gives \(+1\) point, answering incorrectly gives \(-1\) point, and not answering gives \(0\) points. To pass the exam, at least \(k\) points are needed. For each question, Gustav has a guess that he knows is correct with probability \(p_i\) (\(0.5 \leq p_i \leq 1\)). Note that \(p_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 \(n\) and \(k\) (\(1 \leq k \leq n \leq 5000\)). The second line contains \(n\) real numbers \(p_i\) (\(0.5 \leq p_i \leq 1.0\)). These numbers will have at most \(6\) 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 \(10^{-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
문제 정보

생성자가 기록되지 않았습니다.

출처 ICPC NCPC 2022

평가 및 의견

G. Graduation Guarantee

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 1 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

G. Graduation Guarantee

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8