結果
問題 | No.37 遊園地のアトラクション |
ユーザー |
![]() |
提出日時 | 2015-02-21 18:21:27 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 185 ms / 5,000 ms |
コード長 | 463 bytes |
コンパイル時間 | 794 ms |
コンパイル使用メモリ | 6,912 KB |
実行使用メモリ | 6,784 KB |
最終ジャッジ日時 | 2024-10-10 12:52:51 |
合計ジャッジ時間 | 3,122 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 27 |
ソースコード
T=int(raw_input()) N=int(raw_input()) cs = map(int,raw_input().split()) vs= map(int,raw_input().split()) dp = [-1 for i in range(10001)] dp[0]=0 for i in range(N): for j in range(10000,-1,-1): if dp[j]>=0: c=cs[i] v=vs[i] nt = j+c nv = dp[j]+v while nt <= T and v != 0: dp[nt] = max(dp[nt],nv) v/=2 nt+=c nv+=v print max(dp)