結果
問題 | No.664 超能力者Aと株価予測 |
ユーザー | maspy |
提出日時 | 2020-03-12 19:37:28 |
言語 | Python3 (3.11.6 + numpy 1.26.0 + scipy 1.11.3) |
結果 |
AC
|
実行時間 | 627 ms / 4,000 ms |
コード長 | 572 bytes |
コンパイル時間 | 121 ms |
コンパイル使用メモリ | 10,968 KB |
実行使用メモリ | 29,880 KB |
最終ジャッジ日時 | 2023-08-12 06:38:49 |
合計ジャッジ時間 | 8,805 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 131 ms
29,736 KB |
testcase_01 | AC | 135 ms
29,740 KB |
testcase_02 | AC | 135 ms
29,840 KB |
testcase_03 | AC | 132 ms
29,716 KB |
testcase_04 | AC | 132 ms
29,652 KB |
testcase_05 | AC | 133 ms
29,736 KB |
testcase_06 | AC | 146 ms
29,880 KB |
testcase_07 | AC | 144 ms
29,792 KB |
testcase_08 | AC | 246 ms
29,864 KB |
testcase_09 | AC | 140 ms
29,852 KB |
testcase_10 | AC | 623 ms
29,800 KB |
testcase_11 | AC | 606 ms
29,796 KB |
testcase_12 | AC | 627 ms
29,808 KB |
testcase_13 | AC | 620 ms
29,828 KB |
testcase_14 | AC | 129 ms
29,808 KB |
ソースコード
#!/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())