結果

問題 No.555 世界史のレポート
ユーザー sue_charosue_charo
提出日時 2017-08-11 23:40:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 1,107 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 16,128 KB
最終ジャッジ日時 2024-04-20 23:49:09
合計ジャッジ時間 7,669 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
16,128 KB
testcase_01 AC 28 ms
10,752 KB
testcase_02 AC 28 ms
10,880 KB
testcase_03 AC 29 ms
10,752 KB
testcase_04 AC 31 ms
10,752 KB
testcase_05 AC 33 ms
10,752 KB
testcase_06 AC 31 ms
10,752 KB
testcase_07 AC 30 ms
10,880 KB
testcase_08 AC 29 ms
10,624 KB
testcase_09 AC 32 ms
10,752 KB
testcase_10 AC 936 ms
10,880 KB
testcase_11 AC 438 ms
10,752 KB
testcase_12 AC 1,774 ms
10,752 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
import sys
import math
sys.setrecursionlimit(10 ** 6)

def II(): return int(input())
def ILI(): return list(map(int, input().split()))


def read():
    N = II()
    C, V = ILI()
    return N, C, V


def do_copy_paste(now_length, now_cost, now_clip, N, C, V, n_good):
    if now_length >= N:
        return now_cost
    if now_cost >= n_good:
        return n_good
    if now_clip == 0:
        copy = do_copy_paste(now_length, now_cost + C, now_length, N, C, V, n_good)
        return copy
    if now_length == now_clip:
        paste = do_copy_paste(now_length + now_clip, now_cost + V, now_clip, N, C, V, n_good)
        return paste

    copy = do_copy_paste(now_length, now_cost + C, now_length, N, C, V, n_good)
    paste = do_copy_paste(now_length + now_clip, now_cost + V, now_clip, N, C, V, n_good)

    return min(copy, paste)


def solve(N, C, V):
    n_root = int(math.log(N, 2)) + 1
    n_good = (C + V) * n_root
    ans = do_copy_paste(1, 0, 0, N, C, V, n_good)
    return ans


def main():
    params = read()
    print(solve(*params))


if __name__ == "__main__":
    main()
0