結果
問題 | No.37 遊園地のアトラクション |
ユーザー |
![]() |
提出日時 | 2018-04-11 07:41:24 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 69 ms / 5,000 ms |
コード長 | 451 bytes |
コンパイル時間 | 210 ms |
コンパイル使用メモリ | 82,456 KB |
実行使用メモリ | 70,980 KB |
最終ジャッジ日時 | 2024-10-10 13:30:04 |
合計ジャッジ時間 | 2,686 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 27 |
ソースコード
t = int(input()) n = int(input()) c = list(map(int, input().split())) v = list(map(int, input().split())) mc = min(c) for i in range(n): w = v[i]//2 while w: v.append(w) c.append(c[i]) w //= 2 n = len(v) dp = [[0]*(t+1) for _ in range(n+1)] for i in range(n)[::-1]: for j in range(t+1): dp[i][j] = dp[i+1][j] if j+c[i] <= t: dp[i][j] = max(dp[i][j], v[i]+dp[i+1][j+c[i]]) print(dp[0][0])