P9486 "LAOI-1" Bash Game-Plus
Description
> Bash game: There is a pile of $n$ items. Two players take turns taking items from it. Each time, at least $1$ item and at most $m$ items must be taken; skipping is not allowed. The player who takes the last item wins.
We add some rules to this game:
There is a pile of $n$ items. Player A and player B take turns taking items, and player A goes first. Each time, at least $1$ item and at most $m$ items must be taken. The player who takes all remaining items wins.
Now a new rule is added: **you may also choose to take nothing**. However, whenever a player chooses to take nothing, in the next $k$ moves, neither player is allowed to take nothing.
For example, when $k=3$, if player A takes nothing in some move, then in the next three turns (player B, player A, player B), they must each take at least $1$ item. After that, it is player A's turn again, and now player A may choose to take nothing again.
Player A and player B play a total of $t$ games. For each game, you need to tell player A whether he has a winning strategy.
Input Format
The first line contains two positive integers $t, op$. When $op=1$, the newly added rule is canceled, but you still need to read $k$ normally.
The next $t$ lines each contain three positive integers $n, m, k$.
Output Format
For each game, if player A has a winning strategy, output `Yes`. Otherwise output `No`.
Explanation/Hint
| Subtask | Score | $t$ | $op$ | $n\le$ | $m\le$ | $k\le$ | Special property |
| :----------: | :----------: | :----------: | :----------: | :----------: | :----------: | :----------: | :----------: |
| $0$ | $2$ | $100000$ | $1$ | $10^{18}$ | $10^{18}$ | $k=114514$ | |
| $1$ | $2$ | $99994$ | $0$ | $10^{18}$ | $10^{18}$ | $k=1$ | |
| $2$ | $9$ | $99995$ | $0$ | $10^{18}$ | $10^{18}$ | $3$ | |
| $3$ | $5$ | $99996$ | $0$ | $10^{18}$ | $10^{18}$ | $k\ge n$ | |
| $4$ | $10$ | $50$ | $0$ | $50$ | $50$ | $10^{18}$ | |
| $5$ | $13$ | $99997$ | $0$ | $100$ | $100$ | $10^{18}$ | |
| $6$ | $16$ | $99998$ | $0$ | $400$ | $400$ | $10^{18}$ | $A$ |
| $7$ | $10$ | $99999$ | $0$ | $5000$ | $5000$ | $10^{18}$ | |
| $8$ | $31$ | $100000$ | $0$ | $10^{18}$ | $10^{18}$ | $10^{18}$ | |
| $9$ | ~~45~~ $2$ | $99993$ | $0$ | $10^{18}$ | $10^{18}$ | $10^{18}$ | Not allowed, Commander-in-Chief |
Special property $A$: all $m$ are equal.
For all data: $t \le 10^5$, $1 \le n, m, k \le 10^{18}$.
The testdata is not guaranteed to be random.
Translated by ChatGPT 5