結果
| 問題 |
No.37 遊園地のアトラクション
|
| コンテスト | |
| ユーザー |
brthyyjp
|
| 提出日時 | 2021-11-05 01:32:04 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 62 ms / 5,000 ms |
| コード長 | 467 bytes |
| コンパイル時間 | 264 ms |
| コンパイル使用メモリ | 82,244 KB |
| 実行使用メモリ | 66,048 KB |
| 最終ジャッジ日時 | 2024-10-15 08:09:12 |
| 合計ジャッジ時間 | 3,398 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 27 |
ソースコード
t = int(input())
n = int(input())
C = list(map(int, input().split()))
V = list(map(int, input().split()))
dp = [-1]*(t+1)
dp[0] = 0
for c, v in zip(C, V):
for i in reversed(range(t+1)):
if dp[i] == -1:
continue
j = i+c
cur = v
s = v
while j <= t:
dp[j] = max(dp[j], dp[i]+s)
j += c
cur //= 2
s += cur
if cur == 0:
break
print(max(dp))
brthyyjp