P11760 [IAMOI R1] Intelligence Test

Background

Xiao C brought Xiao L to meet his parents-in-law. The parents-in-law decided to test Xiao L's intelligence by posing a problem.

Description

The father-in-law gives an array $a$ indexed from $1$, where initially $a_i = 2^{i-1}$. The mother-in-law asks Xiao L to perform the following operations several times: In the $i$-th operation, choose two numbers $u_i, v_i\ (2 \le u_i < v_i)$, then execute sequentially: - $a_{v_i} \gets a_{v_i} + a_{u_i} + a_{u_i - 1}$ - $a_{u_i} \gets -\infty$ - $a_{u_i - 1} \gets -\infty$ The first operation has no special restrictions, but for each subsequent operation, it must satisfy $v_i > v_{i-1}$. Given $T$ queries, each with two numbers $k$ and $x$, determine whether it's possible to make $a_k = x$ through a finite number of operations. The queries are independent (i.e., the array $a$ should be reset after each query).

Input Format

N/A

Output Format

N/A

Explanation/Hint

For $100\%$ of the data: - $1 \le T \le 5 \times 10^6$ - $1 \le k \le 60$ - $0 \le x \le 4 \times 10^{18}$ | Test Case | $T$ | $k$ | Special Property | Score | | :-------: | :-------: | :-------: | :-------: | :-------: | | 1 | $\le 100$ | $\le 10$ | None | 20 | | 2 | $\le 60$ | $\le 60$ | A | 20 | | 3 | $\le 1 \times 10^5$ | $\le 60$ | None | 30 | | 4 | $\le 5 \times 10^6$ | $\le 60$ | None | 30 | Special Property A: Guarantees $x = 2^{k} - 1$. Please optimize your code for constant factors. The time and memory limits are at least 2.5 times those of the standard solution (with fast I/O). Due to large input/output volume, we strongly recommend using fast I/O templates. ```cpp char *p1,*p2,buf[1