結果

問題 No.664 超能力者Aと株価予測
ユーザー H3PO4H3PO4
提出日時 2020-11-14 08:52:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 163 ms / 4,000 ms
コード長 424 bytes
コンパイル時間 107 ms
コンパイル使用メモリ 10,924 KB
実行使用メモリ 30,236 KB
最終ジャッジ日時 2023-09-30 04:45:57
合計ジャッジ時間 5,472 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
29,736 KB
testcase_01 AC 109 ms
29,784 KB
testcase_02 AC 116 ms
29,844 KB
testcase_03 AC 113 ms
29,724 KB
testcase_04 AC 110 ms
29,944 KB
testcase_05 AC 111 ms
29,668 KB
testcase_06 AC 116 ms
29,796 KB
testcase_07 AC 112 ms
29,784 KB
testcase_08 AC 126 ms
29,920 KB
testcase_09 AC 116 ms
29,828 KB
testcase_10 AC 141 ms
29,980 KB
testcase_11 AC 153 ms
30,096 KB
testcase_12 AC 163 ms
30,236 KB
testcase_13 AC 146 ms
30,084 KB
testcase_14 AC 108 ms
29,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

N, M, K = map(int, input().split())
A = np.array([int(input()) for _ in range(N + 1)])

dp = np.zeros((N + 1, M + 1), dtype=int)
dp[0, 0] = K
for time in range(1, N + 1):
    dp[time] = dp[time - 1]
    sell = dp[:time, :-1] // A[:time, None] * A[time] + dp[:time, :-1] % A[:time, None]
    sell_max = np.maximum.reduce(sell, axis=0)
    dp[time, 1:] = np.maximum(dp[time, 1:], sell_max)
print(dp.max())
0