You are driving a jeep called Chander Gari along the hilly roads from Bandarban to Thanchi. The route consists of $$$n$$$ segments, where segment $$$i$$$ connects Checkpoint $$$i-1$$$ to Checkpoint $$$i$$$. The jeep is equipped with a fuel tank of maximum capacity $$$c$$$ liters and you begin your journey at Checkpoint $$$0$$$ with a full tank.
To travel from Checkpoint $$$i-1$$$ to Checkpoint $$$i$$$, the jeep consumes $$$w_i$$$ liters of fuel. If the tank contains less than $$$w_i$$$ liters of fuel before departure, the jeep stalls and the journey ends.
Upon arriving at any checkpoint $$$i$$$ $$$(1 \le i \le n)$$$, you have the option to refuel. Due to a severe crisis, fuel is strictly limited. If you choose to stop and refuel, the vendor will fill the jeep's tank with exactly $$$r$$$ liters of fuel. If this causes the fuel level to exceed the capacity $$$c$$$, the excess fuel overflows and is wasted.
Your task is to determine a refueling strategy that ensures the jeep safely reaches Checkpoint $$$n$$$ while minimizing the total number of times you stop to refuel.
The first line contains a single integer $$$t$$$ $$$(1 \le t \le 1000)$$$ — the number of test cases. The description of the test cases follows.
The first line of each test case contains three integers $$$n$$$, $$$c$$$ and $$$r$$$ $$$(1 \le n \le 2 \cdot 10^5, 1 \le r \le c \le 10^9)$$$ — the number of segments, the maximum tank capacity, and the fixed amount of fuel (in liters) provided per refill.
The second line of each test case contains $$$n$$$ space-separated integers $$$w_1, w_2, \dots, w_n$$$ $$$(1 \le w_i \le c)$$$ — the fuel required to traverse each successive segment.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^6$$$.
For each test case, output the result on a new line.
If it is impossible to reach Checkpoint $$$n$$$ regardless of the strategy, print "Impossible" (without quotes).
Otherwise, print a binary string of length $$$n$$$. The $$$i$$$-th character of the string $$$(1 \le i \le n)$$$ should be 1 if you want to refuel at Checkpoint $$$i$$$, and 0 otherwise.
The strategy must minimize the total number of 1s. If multiple optimal strategies exist, you may output any one of them.
62 5 51 32 9 49 21 10 939 5 45 4 2 1 3 5 4 2 52 5 25 53 5 43 4 2
00100110111110Impossible110
In the first test case, initially the tank has $$$5$$$ liters of fuel. After traversing the $$$1^{\text{st}}$$$ segment, $$$4$$$ liters remain. The $$$2^{\text{nd}}$$$ segment requires $$$3$$$ liters. Since we have $$$4$$$ liters, we can complete the segment. There is no need to refuel at this point.
In the last test case, initially the tank has $$$5$$$ liters of fuel. After traversing the $$$1^{\text{st}}$$$ segment, $$$2$$$ liters remain. Since the $$$2^{\text{nd}}$$$ segment requires $$$4$$$ liters and the tank does not have enough fuel, we need to refuel at Checkpoint 1. After refilling, the fuel level becomes $$$\min(2 + 4, 5) = 5$$$ liters.
Now, the $$$2^{\text{nd}}$$$ segment can be traversed. It consumes $$$4$$$ liters, leaving $$$1$$$ liter in the tank. The $$$3^{\text{rd}}$$$ segment requires $$$2$$$ liters, but the tank has only $$$1$$$ liter. So, we must refuel again at Checkpoint 2. After this refill, the fuel level becomes $$$\min(1 + 4, 5) = 5$$$ liters.
Now, the $$$3^{\text{rd}}$$$ segment can be traversed. It consumes $$$2$$$ liters, leaving $$$3$$$ liters in the tank. No further refueling is needed.
| Название |
|---|


