[ICPC2024 Xi'an I] Chained Lights

题目描述

You have $n$ lights in a row. Initially, they are all off. You are going to press these $n$ lights one by one. When you press light $i$, light $i$ will switch its state, which means it will turn on if it's off and turn off if it's on, and then for every $j$ satisfied $i|j,i< j\le n$, press light $j$ once. For example, if $n=4$, when you press light $1$, light $1$ will turn on, and then you will press light $2,3,4$. Since you pressed light $2$, light $2$ will turn on and you will press light $4$, which will cause light 4 to turn on. After all the operations, lights $1,2,3$ will be turned on and light $4$ is still off. You will press these $n$ lights and do the operations as mentioned above one by one. After all the operations, you want to know whether light $k$ is on or off. You can also use the following code to understand the meaning of the problem: cpp void press(int x) { light[x]^=1; for (int y=x+x;y<=n;y+=x) press(y); } for (int i=1;i<=n;i++) press(i); 

输入输出格式

输入格式

There are multiple testcases. The first line contains an integer $T(1\le T\le10^5)$, which represents the number of testcases. Each of the testcases contains two integers $n,k(1\le k\le n\le10^6)$ in a single line.

输出格式

For each testcase, if light $k$ is turned on in the end, output $\text{YES}$, otherwise output $\text{NO}$.

输入输出样例

输入样例 #1

2
1 1
3 2

输出样例 #1

YES
NO