結果

問題 No.2567 A_1 > A_2 > ... > A_N
ユーザー oginoshikibuoginoshikibu
提出日時 2023-12-02 16:57:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 340 ms / 2,000 ms
コード長 405 bytes
コンパイル時間 488 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 83,944 KB
最終ジャッジ日時 2023-12-02 16:57:32
合計ジャッジ時間 4,528 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
53,460 KB
testcase_01 AC 77 ms
80,788 KB
testcase_02 AC 83 ms
83,104 KB
testcase_03 AC 79 ms
82,064 KB
testcase_04 AC 85 ms
83,212 KB
testcase_05 AC 89 ms
83,944 KB
testcase_06 AC 311 ms
77,528 KB
testcase_07 AC 305 ms
77,396 KB
testcase_08 AC 295 ms
77,528 KB
testcase_09 AC 306 ms
77,556 KB
testcase_10 AC 340 ms
77,428 KB
testcase_11 AC 36 ms
53,460 KB
testcase_12 AC 45 ms
62,340 KB
testcase_13 AC 35 ms
53,460 KB
testcase_14 AC 32 ms
53,460 KB
testcase_15 AC 46 ms
62,360 KB
testcase_16 AC 34 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
    n,x=map(int, input().split())
    if (n*(n+1))//2>x:
        print(-1)
        continue
    L=[i for i in range(1,n+1)]
    diff = x-(n*(n+1))//2
    if diff==0:
        print(*L[::-1])
        continue

    for i in range(1,n+1):
        num=n-i+1
        L[-i]+=(diff+num-1)//num
        diff-=(diff+num-1)//num
        if diff==0:
            break
    print(*L[::-1])
0