logo AlgoBeat OnlineJudge
登录 注册

#212857. [NERC 2022] Game of Questions

内存限制:1024 MiB 时间限制:5000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Genie is taking part in an intellectual game. The game consists of questions, and there are participants numbered from to . Genie is the participant number .

For each question and participant , it is known whether the participant will answer the question correctly or not.

The goal of the game is to be the last participant staying in the game.

The game is conducted as follows. First, all questions get shuffled uniformly at random (all permutations are equally likely). Then, the questions are asked one by one. Each participant answers the question. If all participants still in the game answer the question correctly, or if all of them answer the question incorrectly, nothing happens. Otherwise, those participants who answer the question incorrectly lose and leave the game.

After all questions are asked, all participants who are still in the game are declared to be the winners.

What is the probability that Genie will win the game?

输入格式

The first line contains two integers and --- the number of questions and the number of participants (; ).

The -th of the next lines contains characters . Character is if participant answers question correctly or otherwise.

输出格式

Print the probability that Genie will win the game. Your answer will be considered correct if its absolute or relative error does not exceed .

样例

样例输入 1

1 5
11010

样例输出 1

1.0000000000000000

样例输入 2

3 3
011
101
110

样例输出 2

0.3333333333333333

样例输入 3

6 4
1011
0110
1111
0110
0000
1101

样例输出 3

0.1666666666666667

数据范围与提示

In the first example, there is a single question and Genie will answer it correctly, thus winning the game (along with participants and ).

In the second example, one participant will leave after the first asked question, and another participant will leave after the second asked question. Each participant will win with probability .