問題一覧 > 通常問題

No.2560 A_1 < A_2 < ... < A_N

レベル : / AI推定難易度 : 180 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 278
作問者 : Kyo_s_s / テスター : deuteridayo 👑 AngrySadEight kusirakusira Magentor DeltaStruct 👑 loop0919 bluebery1001 rotti_coder ragna マベマス(mavemas_413) けんぴん aki
お気に入りにしたユーザー ProblemId : 10161 / 自分の提出
問題文最終更新日: 2023-12-01 20:16:10
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
第2回緑以下コンテスト (順位表) の他の問題:

Problem Statement

You are given positive integers $N, X$. Determine whether there exists a sequence $A_1, A_2, \ldots, A_N$ consisting of $N$ positive integers that satisfies all of the following conditions:

  • $0 < A_1 < A_2 < \cdots < A_{N-1} < A_N$
  • $\displaystyle \sum_{i=1}^N A_i = X$

If such a sequence exists, output the lexicographically smallest one.

You are given $T$ test cases; solve each of them.

What is the lexicographic order for sequences of equal length? For $2$ integer sequences of equal length $A=(A_1,A_2,\ldots ,A_N)$ and $B=(B_1,B_2,\ldots ,B_N)$, $A < B$ in lexicographic order is defined to hold if and only if the following is satisfied.
  • There exists an integer $i \ (1 \le i \le N)$ such that $A_j = B_j$ holds for all integers $j$ with $1 \le j < i$, and $A_i < B_i$ holds.

Constraints

  • $1 \leq T \leq 10^5$
  • $1 \leq N \leq 2 \times 10^5$
  • $1 \leq X \leq 10^{18}$
  • For the test cases contained in $1$ input, the sum of their $N$ is at most $2 \times 10^5$
  • All input values are integers

Input

The input is given from standard input in the following format.

$T$
$\text{case}_1$
$\vdots$
$\text{case}_T$

Each test case $\text{case}_i~(1 \leq i \leq T)$ is given in the following format.

$N ~ X$

Output

Output $T$ lines. On the $i$-th line, if a sequence satisfying the conditions exists for test case $\text{case}_i$, output that sequence separated by spaces on $1$ line; otherwise, output $-1$.

Sample

Sample 1
Input
3
4 10
3 5
3 9
Output
1 2 3 4
-1
1 2 6
  • For test case $1$, the only sequence satisfying the $2$ conditions in the problem statement is $(1, 2, 3, 4)$. Therefore, output this.
  • For test case $2$, no sequence satisfies the $2$ conditions in the problem statement. Therefore, output $-1$.
  • For test case $3$, the sequences satisfying the $2$ conditions in the problem statement are
    • $(1, 2, 6)$
    • $(1, 3, 5)$
    • $(2, 3, 4)$
    and only these $3$. Therefore, output $(1, 2, 6)$, the lexicographically smallest among them.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。