#P13713. 晴天
晴天
Description
Little P has the ability to control the weather. On the -th day, he specifies a weather value , where . After days, Little P obtains a sequence of weather values of length .
The local residents have a unique way to determine the weather. For the -th day (), they calculate a new value and judge the weather as follows:
-
If , the residents consider the -th day to be sunny.
-
If , the residents consider the -th day to be cloudy.
-
Otherwise, the residents consider the -th day to be rainy.
Note that the 1st day and the -th day are always considered rainy by default. The local residents take the weather very seriously and hope that there are exactly sunny days and cloudy days in these days. Please determine whether Little P can achieve this and provide a feasible sequence if possible. Otherwise, indicate that it is impossible.
Input Format
This problem contains multiple test cases.
The first line of input contains an integer , representing the number of test cases.
For each test case, there is one line containing three integers , representing the number of days, the required number of sunny days, and the required number of cloudy days, respectively.
Output Format
For each test case:
-
If a solution exists, output a line of integers, representing your constructed sequence.
-
If no solution exists, output a single integer .
If there are multiple valid solutions, you only need to output any one of them.
2
5 1 1
4 2 2
0 1 0 -1 0
-2
Hint
Sample Explanation
-
For the first test case,
0 1 0 -1 0is a valid sequence where the 2nd day is sunny and the 4th day is cloudy. Note that the solution may not be unique;1 1 0 -1 -1is also a valid solution. -
For the second test case, it can be proven that no valid solution exists.
Data Constraints
Subtasks are used in this problem.
- Subtask 0 (0 pts): Sample cases.
- Subtask 1 (5 pts): .
- Subtask 2 (15 pts): .
- Subtask 3 (10 pts): .
- Subtask 4 (15 pts): .
- Subtask 5 (15 pts): or .
- Subtask 6 (25 pts): .
- Subtask 7 (15 pts): .
For all test cases, it is guaranteed that , , and .
京公网安备 11011102002149号