結果

問題 No.37 遊園地のアトラクション
コンテスト
ユーザー rin204
提出日時 2022-07-06 07:11:34
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 33 ms / 5,000 ms
コード長 278 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 112 ms
コンパイル使用メモリ 85,056 KB
実行使用メモリ 61,660 KB
最終ジャッジ日時 2026-05-27 02:52:39
合計ジャッジ時間 2,584 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

t = int(input())
n = int(input())
C = list(map(int, input().split()))
V = list(map(int, input().split()))
dp = [0] * (t + 1)
for c, v in zip(C, V):
    while v > 0:
        for i in range(t, c - 1, -1):
            dp[i] = max(dp[i], dp[i - c] + v)
        v >>= 1
print(dp[-1])
0