結果

問題 No.2567 A_1 > A_2 > ... > A_N
ユーザー lloyz
提出日時 2023-12-18 00:03:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 139 ms / 2,000 ms
コード長 386 bytes
コンパイル時間 180 ms
コンパイル使用メモリ 82,784 KB
実行使用メモリ 83,752 KB
最終ジャッジ日時 2024-09-27 08:11:52
合計ジャッジ時間 3,280 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

for _ in range(int(input())):
    n, x = map(int, input().split())
    min_ = n * (n + 1) // 2
    if x < min_:
        print(-1)
        continue
    d = x - min_
    q, r = divmod(d, n)
    ANS = [n - i for i in range(n)]
    for i in range(n):
        if i < r:
            ANS[i] += q + 1
        else:
            ANS[i] += q
    print(*ANS)
0