AtCoder Grand Contest 053
翻译中…
Problem Statement
翻译中…
$2N+1$ players will play a game called Majority Vote. Each player casts a vote to one of the two options given, and the players choosing the option that ends up with the greater number of votes will win. The detailed progression of the vote is as follows:
翻译中…
- If everyone has already voted, the vote ends. Otherwise, proceed to step 2.
- One player is chosen randomly among the players who have not voted, and s/he casts a vote. Then, go back to step 1.
翻译中…
$K$ of the players are ESPers, who can know the number of votes cast to each option when they cast votes. Thus, the players choose the option to cast as follows:
翻译中…
- A player who is an ESPer chooses the option with the greater number of votes at the moment. If the two options have the same number of votes, s/he chooses one option randomly and votes for it.
- A player who is not an ESPer randomly chooses one option and votes for it.
翻译中…
X is a player of the game who is also an ESPer. Find the probability that X wins, modulo $(10^9+7)$ (see Notes).
翻译中…
Note
翻译中…
- The expected value in question will be a rational number. If we express it as a fractional number
$\frac{y}{x}$where$x$and$y$are coprime positive integers,$x$will be coprime with$P=10^9+7$, so print the only integer$z$between$0$and$P-1$(inclusive) such that$xz \equiv y \pmod P$.
翻译中…
Constraints
翻译中…
$1 \leq N \leq 2\times 10^6$$1 \leq K \leq 2N+1$
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N K
翻译中…
Output
翻译中…
Print the answer.
翻译中…
样例
Input #1
1 1
Output #1
916666674
X wins with probability $\frac{11}{12}$.
Input #2
1 2
Output #2
958333341
X wins with probability $\frac{23}{24}$.
Input #3
8 5
Output #3
582281799
Input #4
100 100
Output #4
196654831
Input #5
2000000 2000000
Output #5
768385859
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。