#P13713. 晴天

    ID: 13412 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 5 上传者: 标签>贪心洛谷原创Special JudgeO2优化构造洛谷月赛

晴天

Description

Little P has the ability to control the weather. On the ii-th day, he specifies a weather value aia_i, where ai{1,0,1}a_i \in \{-1, 0, 1\}. After nn days, Little P obtains a sequence of weather values aa of length nn.

The local residents have a unique way to determine the weather. For the ii-th day (2in12 \le i \le n-1), they calculate a new value si=ai1+ai+ai+1s_i = a_{i-1} + a_i + a_{i+1} and judge the weather as follows:

  • If 1si2\bm{1 \le s_i \le 2}, the residents consider the ii-th day to be sunny.

  • If 2si1\bm{-2 \le s_i \le -1}, the residents consider the ii-th day to be cloudy.

  • Otherwise, the residents consider the ii-th day to be rainy.

Note that the 1st day and the nn-th day are always considered rainy by default. The local residents take the weather very seriously and hope that there are exactly x\bm{x} sunny days and y\bm{y} cloudy days in these nn 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 TT, representing the number of test cases.

For each test case, there is one line containing three integers n,x,yn, x, y, 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 nn integers, representing your constructed sequence.

  • If no solution exists, output a single integer 2-2.

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 0 is 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 -1 is 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): n10\sum n \le 10.
  • Subtask 2 (15 pts): n30\sum n \le 30.
  • Subtask 3 (10 pts): x+y>nx + y > n.
  • Subtask 4 (15 pts): x+yn3x + y \le \lfloor \frac{n}{3} \rfloor.
  • Subtask 5 (15 pts): x=0x = 0 or y=0y = 0.
  • Subtask 6 (25 pts): n103\sum n \le 10^3.
  • Subtask 7 (15 pts): n106\sum n \le 10^6.

For all test cases, it is guaranteed that 1n1061 \le n \le 10^6, n106\sum n \le 10^6, and 0x,yn0 \le x, y \le n.