結果

問題 No.2567 A_1 > A_2 > ... > A_N
ユーザー Rusty
提出日時 2023-12-02 15:52:32
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 616 bytes
コンパイル時間 367 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 19,996 KB
最終ジャッジ日時 2024-09-26 19:26:11
合計ジャッジ時間 4,247 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other TLE * 1 -- * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

def sub(l,n):
    return (l + l - (n - 1))*n/2

t = int(input())

for case in range(t):
    n,x = map(int,input().split())
    if x < n*(n+1)/2:
        print(-1)
    else:
        ans = [10**18]
        for i in range(n-1):
            left = 0
            right = ans[-1]-1
            while left + 1 < right:
                mid = (left + right)//2
                if sub(mid - 1, n - 1 - i) < x - mid:
                    left = mid
                else:
                    right = mid
            x -= right
            ans.append(right)
        
        ans.append(x)
        print(*ans[1:])
0