結果
| 問題 |
No.37 遊園地のアトラクション
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-04-16 08:08:16 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 1,453 ms / 5,000 ms |
| コード長 | 552 bytes |
| コンパイル時間 | 241 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 63,744 KB |
| 最終ジャッジ日時 | 2024-10-11 19:25:06 |
| 合計ジャッジ時間 | 10,957 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 27 |
ソースコード
import math
T=int(input())
N=int(input())
C=list(map(int,input().split()))
V=list(map(int,input().split()))
Z=list(zip(C,V))
Z2=Z[:]
for z in Z:
c=z[0]
v=z[1]
while True:
v=math.floor(v/2)
if v<=0:
break
Z2.append((c,v))
A=[[0]*(T+1) for i in range(len(Z2)+1)]
for i in range(1,len(Z2)+1):
for t in range(1,T+1):
z=Z2[i-1]
c=z[0]
v=z[1]
if t-c<0:
A[i][t]=A[i-1][t]
else:
A[i][t]=max(A[i-1][t-c]+v,A[i-1][t])
print(max(list(map(max,A))))