結果

問題 No.2567 A_1 > A_2 > ... > A_N
ユーザー Rusty
提出日時 2023-12-02 15:53:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 598 bytes
コンパイル時間 525 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 97,232 KB
最終ジャッジ日時 2024-09-26 19:29:19
合計ジャッジ時間 13,556 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 11 WA * 4 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

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