結果
問題 | No.555 世界史のレポート |
ユーザー | sue_charo |
提出日時 | 2017-08-11 23:42:46 |
言語 | Python3 (3.11.6 + numpy 1.26.0 + scipy 1.11.3) |
結果 |
AC
|
実行時間 | 1,081 ms / 2,000 ms |
コード長 | 1,118 bytes |
コンパイル時間 | 312 ms |
コンパイル使用メモリ | 10,948 KB |
実行使用メモリ | 8,484 KB |
最終ジャッジ日時 | 2023-08-02 23:59:02 |
合計ジャッジ時間 | 5,717 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 17 ms
8,308 KB |
testcase_01 | AC | 17 ms
8,436 KB |
testcase_02 | AC | 18 ms
8,328 KB |
testcase_03 | AC | 19 ms
8,252 KB |
testcase_04 | AC | 19 ms
8,308 KB |
testcase_05 | AC | 20 ms
8,460 KB |
testcase_06 | AC | 20 ms
8,444 KB |
testcase_07 | AC | 19 ms
8,440 KB |
testcase_08 | AC | 18 ms
8,440 KB |
testcase_09 | AC | 22 ms
8,464 KB |
testcase_10 | AC | 449 ms
8,448 KB |
testcase_11 | AC | 333 ms
8,320 KB |
testcase_12 | AC | 615 ms
8,316 KB |
testcase_13 | AC | 682 ms
8,372 KB |
testcase_14 | AC | 1,081 ms
8,268 KB |
testcase_15 | AC | 100 ms
8,468 KB |
testcase_16 | AC | 313 ms
8,484 KB |
testcase_17 | AC | 115 ms
8,404 KB |
testcase_18 | AC | 368 ms
8,460 KB |
testcase_19 | AC | 418 ms
8,404 KB |
ソースコード
# 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, min(copy, 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()