結果

問題 No.2567 A_1 > A_2 > ... > A_N
ユーザー RustyRusty
提出日時 2023-12-02 15:59:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 437 ms / 2,000 ms
コード長 600 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 89,256 KB
最終ジャッジ日時 2023-12-02 15:59:09
合計ジャッジ時間 5,133 ms
ジャッジサーバーID
(参考情報)
judge10 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,460 KB
testcase_01 AC 137 ms
83,812 KB
testcase_02 AC 152 ms
86,668 KB
testcase_03 AC 156 ms
89,256 KB
testcase_04 AC 152 ms
88,056 KB
testcase_05 AC 156 ms
88,820 KB
testcase_06 AC 362 ms
76,516 KB
testcase_07 AC 418 ms
76,628 KB
testcase_08 AC 434 ms
77,612 KB
testcase_09 AC 359 ms
76,540 KB
testcase_10 AC 437 ms
77,076 KB
testcase_11 AC 49 ms
61,584 KB
testcase_12 AC 55 ms
66,520 KB
testcase_13 AC 46 ms
61,968 KB
testcase_14 AC 36 ms
53,460 KB
testcase_15 AC 55 ms
66,528 KB
testcase_16 AC 45 ms
61,968 KB
権限があれば一括ダウンロードができます

ソースコード

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