結果

問題 No.1658 Product / Sum
コンテスト
ユーザー KuonAyano
提出日時 2021-08-27 22:13:38
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
TLE  
実行時間 -
コード長 494 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 357 ms
コンパイル使用メモリ 20,700 KB
実行使用メモリ 21,760 KB
最終ジャッジ日時 2026-05-15 08:27:45
合計ジャッジ時間 5,116 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 1 TLE * 1 -- * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N, K = map(int, input().split())

V = [1]*N

for i in range (2, 100001):
    def is_ok(arg):
        return arg*i <= K*(arg+i+(N-2))

    def meguru_bisect(ng, ok):
        while (abs(ok - ng) > 1):
            mid = (ok + ng) // 2
            if is_ok(mid):
                ok = mid
            else:
                ng = mid
        return ok

    laid = meguru_bisect(10**150 + 1, 0)
    if laid*i == K*(laid+i+(N-2)):
        V[-1] = laid
        V[-2] = i
        print(*V)
        exit()
0