#P9486. 「LAOI-1」Bash Game-Plus

「LAOI-1」Bash Game-Plus

Problem Description

Bash game: There is a pile of nn items. Two players take turns taking items from it. Each time, at least 11 item and at most mm 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 nn items. Player A and player B take turns taking items, and player A goes first. Each time, at least 11 item and at most mm 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 kk moves, neither player is allowed to take nothing.

For example, when k=3k=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 11 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 tt 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,opt, op. When op=1op=1, the newly added rule is canceled, but you still need to read kk normally.

The next tt lines each contain three positive integers n,m,kn, m, k.

Output Format

For each game, if player A has a winning strategy, output Yes. Otherwise output No.

6 0
2 2 2
3 2 2
4 2 2
7 2 3
13 2 6
14 2 6
Yes
Yes
No
Yes
Yes
No
6 0
4 3 2
5 3 3
13 3 5
13 3 6
5 100 1000000000000
123454204 4321 97
Yes
No
Yes
No
Yes
No

Hint

Subtask Score tt opop nn\le mm\le kk\le Special property
00 22 100000100000 11 101810^{18} k=114514k=114514
11 9999499994 00 k=1k=1
22 99 9999599995 33
33 55 9999699996 knk\ge n
44 1010 5050 5050 101810^{18}
55 1313 9999799997 100100
66 1616 9999899998 400400 AA
77 1010 9999999999 50005000
88 3131 100000100000 101810^{18}
99 45 22 9999399993 Not allowed, Commander-in-Chief

Special property AA: all mm are equal.

For all data: t105t \le 10^5, 1n,m,k10181 \le n, m, k \le 10^{18}.

The testdata is not guaranteed to be random.

Translated by ChatGPT 5