#P11760. Operations on Exponential Array
Operations on Exponential Array
Operations on Exponential Array
Given an array \(a\) indexed starting from \(1\) with initial values \(a_i = 2^{i-1}\), you are allowed to perform the following operation any number of times. In the \(i\)th operation, select two indices \(u_i, v_i\) (where \(2 \leq u_i < v_i\)) and perform:
- \(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\)
For the first operation, there is no additional restriction, but for each subsequent operation it is required that \(v_i > v_{i-1}\). You are given \(T\) independent queries. Each query gives two integers \(k\) and \(x\) (the \(k\)th index and the target value \(x\)). Starting from the initial array for each query, determine whether it is possible after finitely many operations to have \(a_k = x\). Output "YES" if it is possible, and "NO" otherwise.
inputFormat
The first line contains an integer \(T\), the number of queries. Each of the next \(T\) lines contains two space-separated integers \(k\) and \(x\).
outputFormat
For each query, output "YES" if it is possible to achieve \(a_k = x\) via a sequence of operations, and "NO" otherwise. Each answer should be printed on its own line.
sample
1
1 1
YES
</p>