#P6730. [WC2020] 猜数游戏
[WC2020] 猜数游戏
Description
There are pairwise distinct positive integers written on the blackboard, all smaller than . Little J wants to use these numbers to play a number guessing game with Little M.
The rules are very simple. At the start of the game, Little J will randomly choose some of these numbers for Little M to guess. Little M can determine which numbers Little J chose by making several queries.
Each query works as follows: Little M may specify any number . If it is one of the numbers chosen by Little J, then Little J will tell Little M all numbers among his chosen numbers that can be written as , where is any positive integer, and denotes the remainder after division. Otherwise, if was not chosen by Little J, then Little J will only tell Little M that was not chosen.
The game ends immediately after Little M has determined all numbers chosen by Little J.
For example, if , , and the numbers in index order are , and Little J chooses , then one possible process (not necessarily optimal) is:
| Little M's query | Little J's response |
|---|---|
| was not chosen | |
| , | |
| , |
After queries, Little M has determined all numbers chosen by Little J, and the game ends.
Little M still has homework to finish, so he needs to estimate the time spent in the game. He wants to know the expected value of the minimum number of queries he needs to make in order to end the game.
To avoid precision errors, you need to output the remainder of the answer multiplied by modulo . In this problem, you may assume that each time Little J chooses numbers, he selects uniformly at random among all non-empty subsets of . Under this assumption, it can be proven that is always an integer.
Input Format
The first line contains two positive integers and .
The second line contains positive integers, representing in order.
Output Format
Output a single integer in one line, representing the answer.
4 7
1 3 4 6
17
8 9
1 2 3 4 5 6 7 8
532
Hint
Sample 1 Explanation
The table below shows the relationship between the subset chosen by Little J and the minimum number of queries for Little M:
| Subset chosen by Little J | Optimal set of queries |
|---|---|
| $\{3\}, \{3, 4\}, \{3, 6\}, \{3, 4, 6\}, \{1, 3\}, \{1, 3, 4\}, \{1, 3, 6\}, \{1, 3, 4, 6\}$ | |
Therefore, the expected minimum number of queries is .
Constraints
For all test points: , , , and all are pairwise distinct.
For all test points with odd indices, is guaranteed to be a prime; for all test points with even indices, it is guaranteed that there exists an odd prime and an integer such that .
| Test point ID | Special property | Test point ID | Special property | ||||
|---|---|---|---|---|---|---|---|
| None | None | ||||||
| A | B | ||||||
| None | |||||||
| None | |||||||
| A | B | ||||||
| None | None | ||||||
Special property A: Modulo , are pairwise incongruent.
Special property B: For all , .
Translated by ChatGPT 5
京公网安备 11011102002149号