結果
問題 |
No.37 遊園地のアトラクション
|
ユーザー |
|
提出日時 | 2019-06-02 18:12:46 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 1,384 ms / 5,000 ms |
コード長 | 552 bytes |
コンパイル時間 | 286 ms |
コンパイル使用メモリ | 12,928 KB |
実行使用メモリ | 63,744 KB |
最終ジャッジ日時 | 2024-10-10 13:34:32 |
合計ジャッジ時間 | 10,838 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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))))