#P5363. [SDOI2019] 移动金币

[SDOI2019] 移动金币

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 11 cell. A coin cannot be moved out of the board, and it cannot pass over other coins.

Initially, there are mm coins placed on a 1×n1 \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 mm coins are exactly in the leftmost mm 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, nn and mm, 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 109+910^9+9.

10 3
100
199 43
981535230
99999 47
39178973

Hint

Subtask 11 (5050 points): 1n2501 \le n \le 250 and 1m501 \le m \le 50.

Subtask 22 (5050 points): 1n1500001 \le n \le 150000 and 1m501 \le m \le 50.

Translated by ChatGPT 5