P17333 "TPOI-2C" Secret Illumination

Background

[Secret Illumination - Yooh](https://www.bilibili.com/video/BV1oG4y1X7bQ)

Description

Given $n, k$, construct an array $a$ of length $n$ that satisfies the following conditions. - $1 \le a_i \le 10^9$. - $\displaystyle\sum_{i=1}^{n}\sum_{j=i+1}^{n}[a_i < a_j]\times a_j = k$. Here, when the condition $case$ holds, the value of $[case]$ is $1$; otherwise it is $0$. **This problem uses Special Judge. Any answer that satisfies the conditions will be considered correct.**

Input Format

**This problem has multiple test cases.** The first line contains a positive integer $T$, representing the number of test cases. The next $T$ lines each contain two integers $n, k$.

Output Format

For each test case, output one line: if there is a solution, output $n$ integers representing your constructed answer; if there is no solution, output `-1`.

Explanation/Hint

**[Sample #1 Explanation]** For the first test case, we have $3+4+4+4=15$. Another valid answer is `4 2 1 5`, and the value of the expression in the statement is also exactly $5+5+5=15$. For the second test case, it is clearly impossible to construct a valid answer. **[Constraints]** **This problem uses bundled tests.** |$\text{Subtask}$|Score|Special property| |:-:|:-:|:-:| |$0$|$0$|Sample| |$1$|$20$|$n, k \le 8$| |$2$|$20$|$k \le 10^9$| |$3$|$20$|$n \le 500$| |$4$|$20$|$n \le 5000$| |$5$|$20$|None| For $100\%$ of the testdata, it is guaranteed that $1 \le T \le 50$, $1 \le n \le 2 \times 10^5$, and $0 \le k \le 10^{18}$. Note: Incorrect code may cause Special Judge to exceed the time limit, in which case the result will be shown as UKE. Please be sure to take note. Translated by ChatGPT 5