結果

問題 No.2567 A_1 > A_2 > ... > A_N
ユーザー ymskskyymsksky
提出日時 2024-04-10 12:56:22
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 551 bytes
コンパイル時間 446 ms
コンパイル使用メモリ 82,200 KB
実行使用メモリ 86,036 KB
最終ジャッジ日時 2024-04-10 12:56:27
合計ジャッジ時間 4,350 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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