結果
問題 |
No.37 遊園地のアトラクション
|
ユーザー |
![]() |
提出日時 | 2020-09-09 11:05:42 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 740 ms / 5,000 ms |
コード長 | 497 bytes |
コンパイル時間 | 334 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,520 KB |
最終ジャッジ日時 | 2024-10-10 13:44:39 |
合計ジャッジ時間 | 6,523 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 27 |
ソースコード
import sys read=sys.stdin.buffer.read readline=sys.stdin.buffer.readline readlines=sys.stdin.buffer.readlines t=int(readline()) n=int(readline()) c=list(map(int, readline().split())) v=list(map(int, readline().split())) dp=[0]*(t+1) for x, y in zip(c, v): while y: newdp=dp[:] for i, z in enumerate(dp): if i+x>t: break newv=z+y if newdp[i+x]<newv: newdp[i+x]=newv dp=newdp y>>=1 print(dp[t])