結果

問題 No.2567 A_1 > A_2 > ... > A_N
ユーザー evimaevima
提出日時 2023-12-02 14:58:06
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 641 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 88,244 KB
最終ジャッジ日時 2023-12-02 14:58:11
合計ジャッジ時間 4,493 ms
ジャッジサーバーID
(参考情報)
judge10 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 117 ms
83,756 KB
testcase_02 AC 128 ms
85,856 KB
testcase_03 AC 117 ms
84,840 KB
testcase_04 AC 131 ms
88,244 KB
testcase_05 AC 135 ms
88,052 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 46 ms
59,328 KB
testcase_12 AC 51 ms
64,328 KB
testcase_13 AC 44 ms
59,372 KB
testcase_14 AC 37 ms
53,460 KB
testcase_15 AC 51 ms
64,328 KB
testcase_16 AC 44 ms
59,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve_one():
    N, X = map(int, input().split())
    mi = N * (N + 1) // 2
    if X < mi:
        print(-1)
        return
    ans = []
    s = 0
    prev_hi = X
    for i in range(N):
        rest = N - i
        lo, hi = N - i - 1, prev_hi - 1
        while lo + 1 < hi:
            mi = (lo + hi) // 2
            t = (mi + (mi - rest + 1)) * rest // 2
            if s + t >= X:
                hi = mi
            else:
                lo = mi
        ans.append(hi)
        prev_hi = hi
        s += hi
    print(*ans)
            

if __name__ == "__main__":
    T = int(input())
    for i in range(1, T + 1):
        solve_one()
0