結果
| 問題 |
No.37 遊園地のアトラクション
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-07-06 07:11:34 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 54 ms / 5,000 ms |
| コード長 | 278 bytes |
| コンパイル時間 | 150 ms |
| コンパイル使用メモリ | 81,948 KB |
| 実行使用メモリ | 63,404 KB |
| 最終ジャッジ日時 | 2024-12-18 01:14:52 |
| 合計ジャッジ時間 | 2,822 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / 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 = [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])