P10026 "HCOI-R1" The Transformation of Ai

Background

Ai likes numbers. She also likes transformations.

Description

There is an integer $a$ that starts as $1$. Ai wants $a$ to undergo exactly $k$ transformations. Each time, she chooses one of the following two transformations: - $a \gets a - 1$; - $a \gets a \times 2$. Ai is curious whether, after **exactly** $k$ transformations, $a$ can become $n$.

Input Format

**This problem contains multiple test cases.** The first line contains a positive integer $T$, representing the number of test cases. The next $T$ lines each contain two integers, in order $k$ and $n$, representing one query from Ai.

Output Format

Output $T$ lines. For each query, if $a$ can become $n$, output `Yes`; otherwise output `No`.

Explanation/Hint

### Sample Explanation 1 - If $k = 2$ and $n = 5$, it can be proven that there is no solution. - If $k = 2$ and $n = 4$, one possible sequence of operations is: - Step 1: $a \gets a\times 2 = 2$; - Step 2: $a \gets a\times 2 = 4$. - If $k = 3$ and $n = 3$, one possible sequence of operations is: - Step 1: $a \gets a\times 2 = 2$; - Step 2: $a \gets a\times 2 = 4$. - Step 3: $a \gets a-1 = 3$. ### Constraints **This problem uses bundled testdata.** - Subtask 0 (10 pts): $T \leq 10$, $k \leq 15$. - Subtask 1 (25 pts): $n, k \leq 2\times 10^3$. - Subtask 2 (65 pts): No special constraints. For all testdata, $1 \leq T \leq 10^5$, $0 \leq n, k \leq 10^{18}$. Translated by ChatGPT 5