Codeforces Round 996 (Div. 2)
A
Two Frogs
Codeforces
800
原题
←B →
翻译中…

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:

翻译中…
  • The two frogs cannot occupy the same lilypad. This means that Alice cannot jump to a lilypad that Bob is currently occupying, and vice versa.
  • If a frog cannot make a valid jump on its turn, it loses the game. As a result, the other frog wins.
翻译中…

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.

翻译中…

Input

翻译中…

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.

翻译中…

Output

翻译中…

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.

翻译中…

Note

翻译中…

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.

翻译中…

样例

Input #1
5
2 1 2
3 3 1
4 2 3
5 2 4
7 6 2
Output #1
NO
YES
NO
YES
YES
InputCopy OutputCopy
题目信息
题号
2055A
时间限制
1 s
内存限制
256 MB
标签
构造
博弈论
贪心
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。