Codeforces Round 996 (Div. 2) |
---|
Finished |
Roaming through the alligator-infested Everglades, Florida Man encounters a most peculiar showdown. |
There are $$$n$$$ lilypads arranged in a row, numbered from $$$1$$$ to $$$n$$$ from left to right. Alice and Bob are frogs initially positioned on distinct lilypads, $$$a$$$ and $$$b$$$, respectively. They take turns jumping, starting with Alice.
During a frog's turn, it can jump either one space to the left or one space to the right, as long as the destination lilypad exists. For example, on Alice's first turn, she can jump to either lilypad $$$a-1$$$ or $$$a+1$$$, provided these lilypads are within bounds. It is important to note that each frog must jump during its turn and cannot remain on the same lilypad.
However, there are some restrictions:
Determine whether Alice can guarantee a win, assuming that both players play optimally. It can be proven that the game will end after a finite number of moves if both players play optimally.
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 500$$$). The description of the test cases follows.
The first and only line of each test case contains three integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$2 \leq n \leq 100$$$, $$$1 \leq a, b \leq n$$$, $$$a\neq b$$$) — the number of lilypads, and the starting positions of Alice and Bob, respectively.
Note that there are no constraints on the sum of $$$n$$$ over all test cases.
For each test case, print a single line containing either "YES" or "NO", representing whether or not Alice has a winning strategy.
You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.
52 1 23 3 14 2 35 2 47 6 2
NO YES NO YES YES
In the first test case, Alice has no legal moves. Therefore, Alice loses on the first turn.
In the second test case, Alice can only move to lilypad $$$2$$$. Then, Bob has no legal moves. Therefore, Alice has a winning strategy in this case.
In the third test case, Alice can only move to lilypad $$$1$$$. Then, Bob can move to lilypad $$$2$$$. Alice is no longer able to move and loses, giving Bob the win. It can be shown that Bob can always win regardless of Alice's moves; hence, Alice does not have a winning strategy.
Name |
---|