#P17333. 「TPOI-2C」Secret Illumination

    ID: 19610 远端评测题 1400ms 512MiB 尝试: 0 已通过: 0 显示难度提高 上传者: 标签>洛谷原创Special JudgeO2优化洛谷月赛

「TPOI-2C」Secret Illumination

Background

Secret Illumination - Yooh

Problem Description

Given n,kn, k, construct an array aa of length nn that satisfies the following conditions.

  • 1≤ai≤1091 \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 casecase holds, the value of [case][case] is 11; otherwise it is 00.

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 TT, representing the number of test cases.

The next TT lines each contain two integers n,kn, k.

Output Format

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

4
4 15
7 1
3 21
10 1145141919810
2 3 1 4
-1
2009 12 21
-1

Hint

[Sample #1 Explanation]

For the first test case, we have 3+4+4+4=153+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=155+5+5=15.

For the second test case, it is clearly impossible to construct a valid answer.

[Constraints]

This problem uses bundled tests.

Subtask\text{Subtask} Score Special property
00 Sample
11 2020 n,k≤8n, k \le 8
22 k≤109k \le 10^9
33 n≤500n \le 500
44 n≤5000n \le 5000
55 None

For 100%100\% of the testdata, it is guaranteed that 1≤T≤501 \le T \le 50, 1≤n≤2×1051 \le n \le 2 \times 10^5, and 0≤k≤10180 \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