結果

問題 No.3014 岩井満足性問題
コンテスト
ユーザー i_taku
提出日時 2025-02-04 09:34:14
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
MLE  
実行時間 -
コード長 531 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 167 ms
コンパイル使用メモリ 84,864 KB
実行使用メモリ 352,660 KB
最終ジャッジ日時 2026-06-27 08:48:17
合計ジャッジ時間 9,353 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12 MLE * 2 -- * 4
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N, D, K = map(int, input().split())
A = list(map(int, input().split()))
C = list(map(int, input().split()))

INF = 1 << 90
dp = [[-INF] * (K + 1) for _ in range(D + 1)]
dp[0][0] = 0
for a, c in zip(A, C):
    for d in range(D, 0, -1):
        cum_max = dp[d - 1][:]
        for k in range(K, 0, -1):
            cum_max[k - 1] = max(cum_max[k - 1], cum_max[k])
        for k in range(K, 0, -1):
            dp[d][k] = max(dp[d][k], cum_max[max(0, k - c)] + a)

ans = dp[D][K]
if ans < -10**18:
    print("No")
else:
    print(ans)
0