2026牛客国庆集训派对day6
E
Malfunctioning Typewriter
牛客竞赛
未评级
原题
← DF →

Malfunctioning Typewriter官方中文

题目描述

官方中文

Recently, Bobo, having some free time, wants to write a poem. His method of writing poems is straightforward: he carefully selects $n$ verses, where each verse is a binary string of length $m$ and all $n$ verses are distinct. He then considers any concatenation of these $n$ verses in any order to form a binary string of length $nm$ as a good poem. Unfortunately, Bobo only has a broken typewriter. When Bobo tries to type $x$ (where $x$ is either $0$ or $1$) on paper, the typewriter has a probability $p$ ($0.5\leq p<1$) of typing $x$ correctly and a probability $1-p$ of typing $1−x$. Bobo wants to know, using the optimal strategy, what is the maximum probability that he can write a good poem?官方中文

输入格式

官方中文

The first line of input contains three integers $n,m,p$ ($1\leq n\leq 1000,1\leq m\leq 1000,0.5\leq p<1$), which represent the number of verses, the length of each verse, and the probability that the typewriter works correctly, respectively. The probability $p$ is guaranteed to have at most six decimal places.官方中文

Then $n$ lines follow, with the $i$-th line $(1\leq i\leq n)$ containing a binary string of length $m$, representing the content of the $i$-th verse. It is guaranteed that the $n$ verses are distinct.官方中文

输出格式

官方中文

Output a single number in a line, representing the maximum probability that Bobo can write a good poem using the optimal strategy. Your answer will be considered correct if and only if its absolute or relative error does not exceed $10^{-9}$. Formally, if the correct answer is $a$ and your output is $b$, then your answer will be considered correct if and only if $\frac{|a-b|}{\max(b,1)}\leq 10^{-9}$.官方中文

样例

Input #1
1 3 0.5
000
Output #1
0.125000000000
The only good poem that meets Bobo's requirements is $000$. In this case, every time Bobo presses $0$ or $1$, there is always a $0.5$ probability of getting the desired $0$. Under the optimal strategy, there is a probability of $(0.5)^3=0.125$ of producing a good poem.
Input #2
2 3 0.9
010
101
Output #2
0.590490000000
Input #3
4 2 0.618
00
01
10
11
Output #3
0.201586731534
题目信息
题号
nc140734pe
时间限制
1 s
内存限制
1024 MB

题面与样例版权归 牛客竞赛 及出题人所有;中文翻译由 AI 生成(官方原文),如有出入请以原文为准。