| Bitshift2026-IITM,ProgClub |
|---|
| Закончено |
You are given a binary string $$$s$$$ of length $$$n$$$. This binary string represents an integer (without trailing zeroes) $$$x$$$.
$$$m$$$ operations are then performed on this integer. In each operation, an integer $$$k$$$ is given, and the value of $$$x$$$ is updated to $$$\lfloor x \cdot 2^{k} \rfloor$$$. Equivalently, this operation can be understood as:
Output (without leading zeroes) the binary string corresponding to the final value of $$$x$$$ after all $$$m$$$ operations.
The first line of each test contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases.
The first line of each test case contains two space-separated integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 2 \cdot 10^5$$$) — the length of the binary string and the number of operations.
The second line of each test case contains a binary string $$$s$$$ (consisting only of the characters 0 and 1). It is guaranteed that $$$|s| = n$$$ and that the first character of $$$s$$$ is 1.
The third line of each test case contains $$$m$$$ space-separated integers $$$k_i$$$ ($$$-2 \cdot 10^5 \le k_i \le 2 \cdot 10^5$$$) — the value of $$$k$$$ for the $$$i^{\text{th}}$$$ operation. It is guaranteed that the sum of $$$k$$$ over all operations lies between $$$-2 \cdot 10^5$$$ and $$$2 \cdot 10^5$$$.
It is guaranteed that the sum of $$$n$$$ over all test cases and the sum of $$$m$$$ over all test cases are both at most $$$2 \cdot 10^5$$$.
For each test case, output a single line containing a binary string corresponding to the final value of $$$x$$$. The binary string should not contain any leading zeroes — it should either be "0" or start with a 1.
21 21-1 1810 511111010102 -4 6 -8 10
01111100000000000
For the first test case, the binary string $$$s$$$ is "1" which corresponds to the integer $$$x = 1$$$.
For the second test case, the binary string $$$s$$$ is "1111101010" which corresponds to the integer $$$x = 2026$$$.
| Название |
|---|


