結果

問題 No.664 超能力者Aと株価予測
ユーザー convexineqconvexineq
提出日時 2021-03-03 18:01:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 88 ms / 4,000 ms
コード長 359 bytes
コンパイル時間 184 ms
コンパイル使用メモリ 82,976 KB
実行使用メモリ 65,760 KB
最終ジャッジ日時 2024-04-14 10:02:38
合計ジャッジ時間 1,892 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,960 KB
testcase_01 AC 38 ms
52,920 KB
testcase_02 AC 39 ms
52,832 KB
testcase_03 AC 36 ms
52,868 KB
testcase_04 AC 37 ms
52,088 KB
testcase_05 AC 38 ms
52,824 KB
testcase_06 AC 49 ms
61,368 KB
testcase_07 AC 48 ms
61,596 KB
testcase_08 AC 58 ms
63,496 KB
testcase_09 AC 44 ms
60,456 KB
testcase_10 AC 68 ms
64,376 KB
testcase_11 AC 88 ms
64,452 KB
testcase_12 AC 83 ms
65,760 KB
testcase_13 AC 71 ms
64,360 KB
testcase_14 AC 37 ms
52,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,k,*a = map(int,open(0).read().split())
n += 1
dp = [[-1]*(m+1)]
dp[0][0] = k
for i in range(n):
    ndp = dp[-1][:]
    for j in range(1,m+1)[::-1]:
        if ndp[j-1] == -1: continue
        for l in range(i):
            if a[i] > a[l]:
                ndp[j] = max(ndp[j], dp[l][j-1]%a[l] + dp[l][j-1]//a[l]*a[i])
    dp.append(ndp)
print(max(dp[-1]))
0