P5363 [SDOI2019] Moving Coins
Description
Alice and Bob are going to play the following game. They take turns, and Alice moves first.
When it is a player's turn, they may choose one coin and move it any number of cells to the left, but at least $1$ cell.
A coin cannot be moved out of the board, and it cannot pass over other coins.
Initially, there are $m$ coins placed on a $1 \times n$ board. Each coin occupies a distinct cell, and each cell contains at most one coin.
If, on a player's turn, they can no longer make any valid move (obviously, at this time the $m$ coins are exactly in the leftmost $m$ cells), then that player is judged to lose. It is known that Alice and Bob are both extremely smart, and they can always make the optimal move in any position. So, how many initial states can guarantee that Alice, as the first player, will win?
Input Format
The input contains only one line with two positive integers, $n$ and $m$, in this order, as described in the statement.
Output Format
Output one integer, the number of initial states that can guarantee Alice, as the first player, will win. Since the answer may be very large, output it modulo $10^9+9$.
Explanation/Hint
Subtask $1$ ($50$ points): $1 \le n \le 250$ and $1 \le m \le 50$.
Subtask $2$ ($50$ points): $1 \le n \le 150000$ and $1 \le m \le 50$.
Translated by ChatGPT 5