結果

問題 No.2567 A_1 > A_2 > ... > A_N
ユーザー RustyRusty
提出日時 2023-12-02 15:58:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 600 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 11,776 KB
実行使用メモリ 21,140 KB
最終ジャッジ日時 2023-12-02 15:58:46
合計ジャッジ時間 3,749 ms
ジャッジサーバーID
(参考情報)
judge13 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
16,916 KB
testcase_01 TLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
権限があれば一括ダウンロードができます

ソースコード

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**19]
        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