結果
| 問題 |
No.664 超能力者Aと株価予測
|
| コンテスト | |
| ユーザー |
htkb
|
| 提出日時 | 2019-04-01 20:55:52 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 319 ms / 4,000 ms |
| コード長 | 533 bytes |
| コンパイル時間 | 84 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-11-26 08:58:26 |
| 合計ジャッジ時間 | 2,205 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 |
ソースコード
import sys
from itertools import accumulate
N, M, K = map(int, input().split())
stock_price = list(map(int, sys.stdin))
dp = [K]*len(stock_price)
for _ in [0]*M:
for t1, price1 in zip(range(N, -1, -1), stock_price[N::-1]):
stock_count, rem = dp[t1] // price1, dp[t1] % price1
for t2, price2 in enumerate(stock_price[t1+1:], start=t1+1):
if price1 < price2 and dp[t2] < stock_count * price2 + rem:
dp[t2] = stock_count * price2 + rem
dp = list(accumulate(dp, max))
print(max(dp))
htkb