P28479 [洛谷] [SDOI2019] Moving Coins
提高+
题目描述

Problem Description

Alice and Bob are about to play a game as follows. Both players take turns, with Alice going first.
When it's a player's turn, they can choose one coin and move it any number of spaces to the left, with at least one space moved.
Coins cannot be moved off the board or jump over other coins.

Initially, there are $m$ coins placed on a $1 \times n$ board. Each coin occupies a separate square, and no more than one coin can be in any square.

If a player cannot make any valid moves (obviously, this happens when all $m$ coins are exactly in the leftmost $m$ squares), that player is declared the loser. It is known that both Alice and Bob are extremely intelligent and always make the optimal move in any situation. How many initial states guarantee that Alice, as the first player, can always win?

Input Format

The input consists of a single line containing two positive integers, $n$ and $m$, as described in the problem.

Output Format

Output a single integer representing the number of initial states that guarantee Alice can win as the first player. Since the answer may be very large, output the result modulo $10^9 + 9$.

Sample Input and Output

Sample Input #1

10 3

Sample Output #1

100

Sample Input #2

199 43

Sample Output #2

981535230

Sample Input #3

99999 47

Sample Output #3

39178973

Notes

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$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
10 3
样例输出
100