結果
問題 | No.664 超能力者Aと株価予測 |
ユーザー |
![]() |
提出日時 | 2020-03-12 19:37:28 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 971 ms / 4,000 ms |
コード長 | 572 bytes |
コンパイル時間 | 92 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 44,212 KB |
最終ジャッジ日時 | 2024-11-19 04:42:53 |
合計ジャッジ時間 | 11,627 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 15 |
ソースコード
#!/usr/bin/env python3.8 # %% import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np # %% N, M, K = map(int, readline().split()) A = np.array([0] + read().split(), np.int64) # %% dp = np.zeros((N + 2, M + 1), np.int64) dp[0, 0] = K dp[1, 0] = K for sell in range(2, N + 2): dp[sell] = dp[sell - 1] for buy in range(1, sell): x = dp[buy - 1, :-1] + dp[buy - 1, :-1] // A[buy] * (A[sell] - A[buy]) np.maximum(dp[sell, 1:], x, out=dp[sell, 1:]) # %% print(dp.max())