estie プログラミングコンテスト2024 (AtCoder Regular Contest 188)
B
Symmetric Painting
AtCoder
⌀ 1602
原题
← AC →
翻译中…

Problem Statement

翻译中…

On a circle, there are $N$ equally spaced points numbered $0,1,\ldots,N-1$ in this order, with Alice at point $0$ and Bob at point $K$. Initially, all points are colored white. Starting with Alice, they alternately perform the following operation:

翻译中…
  • Choose one of the currently white points and color it black. Here, after the operation, the coloring of the points must be symmetric with respect to the straight line connecting the operator and the center of the circle.
翻译中…

If the operator cannot perform an operation satisfying the above condition, the sequence of operations ends there.

翻译中…

Both players cooperate and make the best choices to maximize the total number of points colored black in the end. Determine whether all points are colored black at the end of the sequence of operations.

翻译中…

You are given $T$ test cases to solve.

翻译中…

Constraints

翻译中…
  • $1 \leq T \leq 10^5$
  • $2 \leq N \leq 2 \times 10^5$
  • $1 \leq K \leq N-1$
  • All input values are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

T
\mathrm{case}_1
\mathrm{case}_2
\vdots
\mathrm{case}_T

翻译中…

Each test case $\mathrm{case}_i$ $(1 \leq i \leq T)$ is in the following format:

翻译中…

N K

翻译中…

Output

翻译中…

Print $T$ lines. The $i$-th line should contain Yes if all points can be colored black for the $i$-th test case, and No otherwise.

翻译中…

样例

Input #1
4
6 2
6 3
6 1
200000 100000
Output #1
Yes
No
Yes
No
For $N=6$ and $K=2$, all points can be colored black by, for example, performing operations in the following order: 1. Alice colors point $3$ black. 2. Bob colors point $1$ black. 3. Alice colors point $5$ black. 4. Bob colors point $2$ black. 5. Alice colors point $4$ black. 6. Bob colors point $0$ black. ![image](https://img.atcoder.jp/arc188/ecb64f0798aaa883117c594cb6db2724.png) For $N=6$ and $K=3$, below is one possible progression. Actually, no matter what they do, they cannot color all points black. 1. Alice colors point $3$ black. 2. Bob colors point $0$ black. 3. Alice cannot color any point black so that the coloring will be symmetric with respect to her line, so she cannot perform the operation.
题目信息
题号
arc188_b
时间限制
2 s
内存限制
1024 MB

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