結果

問題 No.2567 A_1 > A_2 > ... > A_N
ユーザー n_nan_na
提出日時 2024-01-06 08:54:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 349 ms / 2,000 ms
コード長 447 bytes
コンパイル時間 408 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 88,232 KB
最終ジャッジ日時 2024-01-06 08:54:47
合計ジャッジ時間 5,591 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,460 KB
testcase_01 AC 126 ms
84,028 KB
testcase_02 AC 101 ms
86,128 KB
testcase_03 AC 100 ms
88,076 KB
testcase_04 AC 101 ms
87,236 KB
testcase_05 AC 113 ms
88,232 KB
testcase_06 AC 303 ms
76,640 KB
testcase_07 AC 349 ms
77,012 KB
testcase_08 AC 314 ms
76,960 KB
testcase_09 AC 319 ms
76,960 KB
testcase_10 AC 327 ms
76,628 KB
testcase_11 AC 39 ms
53,460 KB
testcase_12 AC 50 ms
64,436 KB
testcase_13 AC 38 ms
53,460 KB
testcase_14 AC 35 ms
53,460 KB
testcase_15 AC 51 ms
64,460 KB
testcase_16 AC 37 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def cs(n):
    return n*(n+1)//2


T = int(input())

for _ in range(T):
    N,X = map(int,input().split())
    P = []
    for i in range(N):
        idx = N - i
        s = cs(idx)
        rem = X - s
        if rem < 0:
            break
        q = rem//idx
        r = rem%idx
        p = idx + q
        if r > 0:
            p += 1
        P.append(p)
        X -= p
        
    if len(P) == N:
        print(*P)
    else:
        print(-1)
0