結果
| 問題 |
No.37 遊園地のアトラクション
|
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2024-08-28 00:52:28 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 61 ms / 5,000 ms |
| コード長 | 408 bytes |
| コンパイル時間 | 439 ms |
| コンパイル使用メモリ | 82,556 KB |
| 実行使用メモリ | 75,256 KB |
| 最終ジャッジ日時 | 2024-08-28 00:52:32 |
| 合計ジャッジ時間 | 3,336 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 27 |
ソースコード
T = int(input())
N = int(input())
C = list(map(int, input().split()))
V = list(map(int, input().split()))
cs = C[:]
vs = V[:]
for c, v in zip(C, V):
v //= 2
while v > 0:
cs.append(c)
vs.append(v)
v //= 2
dp = [0] * (T+1)
for c, v in zip(cs, vs):
for i in reversed(range(T)):
if i+c > T: continue
dp[i+c] = max(dp[i+c], dp[i] + v)
ans = dp[T]
print(ans)
norioc