結果

問題 No.1658 Product / Sum
ユーザー KuonAyanoKuonAyano
提出日時 2021-08-27 22:13:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 494 bytes
コンパイル時間 223 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 17,824 KB
最終ジャッジ日時 2024-05-01 02:50:27
合計ジャッジ時間 4,724 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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