Bingo for the Win!
Time limit1sMemory limit1024 MB
Given each player's bingo sheet and a uniformly random calling order, find the probability that each player is the last to finish under Speed Bingo rules.
- Level
Hard8 of 10
- Topics
- Probability, Combinatorics, Hash map, Dynamic programming
- Solved
- No attempts yet
Problem
Bingo is a game of chance for multiple players. Each player receives a sheet with some numbers, and a game master calls out these numbers in a random order. Players cross off the numbers they have heard, and the first player to cross off all their numbers wins the game. This basic version is fairly sedate. Players only need to stay awake.
In this problem we analyze a more dynamic version called Speed Bingo. The game master also calls out the numbers on the sheets in a random order. However, whenever a number is called, only the first player to signal that they have that number may cross it off their sheet. If a player has the same number multiple times, only one copy may be crossed off at a time. When several players have the same number, the player with the fastest reaction time has the advantage. But how big is that advantage? Finding out is the goal of this problem.
There are players, each receiving a sheet of numbers. The numbers may repeat, and different players may receive different sheets. Player reacts faster than player , who reacts faster than player , and so on, with player being the slowest. The following figure shows three players who each receive four numbers:

When the number is called for the first time, player crosses it off, since player is faster. When is called the second time, player crosses it off. On average, player is expected to do better than players and , because both of them need numbers that player reaches first. Players and share no numbers, so their results are independent of each other, even though player is faster than player .
Suppose the game continues until every player has crossed off all of their numbers, that is, until all numbers on all sheets (counting repeats) have been read. If the order of the numbers is uniformly random, what is the probability that each player finishes last?
Input
The input describes a single game of Speed Bingo. The first line contains two integers and , the number of players and the number of numbers on each sheet (, ). The next lines each contain integers. The th line gives the numbers on the sheet of the th player. All numbers are between and , inclusive.
Output
Output lines, one for each player. The th line contains the probability that player finishes last. All values must be accurate to an absolute error of at most .