結果

問題 No.2567 A_1 > A_2 > ... > A_N
ユーザー ymsksky
提出日時 2024-04-10 12:56:22
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 551 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 82,120 KB
実行使用メモリ 86,048 KB
最終ジャッジ日時 2024-10-02 14:57:59
合計ジャッジ時間 4,266 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 1 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

ans = []
t = int(input())
for _ in range(t):
    n, x = map(int, input().split())
    l = []
    ss = 0
    bef = 10**18 + 1
    for i in range(n, 0, -1):
        left = i - 1
        right = bef
        while right - left > 1:
            mid = (left + right) // 2
            s = mid * (mid + 1) // 2
            if s >= x - ss:
                right = mid
            else:
                left = mid
        l.append(right)
        ss += right
        bef = right
    l = l if sum(l) == x else [-1]
    ans.append(l)
for an in ans:
    print(*an)
0