結果

問題 No.37 遊園地のアトラクション
ユーザー zimphazimpha
提出日時 2017-12-13 22:56:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 51 ms / 5,000 ms
コード長 347 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 82,380 KB
実行使用メモリ 63,640 KB
最終ジャッジ日時 2024-04-18 20:04:07
合計ジャッジ時間 2,773 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
61,988 KB
testcase_01 AC 41 ms
59,648 KB
testcase_02 AC 47 ms
61,792 KB
testcase_03 AC 47 ms
62,200 KB
testcase_04 AC 41 ms
60,780 KB
testcase_05 AC 48 ms
62,272 KB
testcase_06 AC 45 ms
61,720 KB
testcase_07 AC 46 ms
63,508 KB
testcase_08 AC 42 ms
61,084 KB
testcase_09 AC 39 ms
59,832 KB
testcase_10 AC 45 ms
63,152 KB
testcase_11 AC 47 ms
63,316 KB
testcase_12 AC 44 ms
61,312 KB
testcase_13 AC 45 ms
61,092 KB
testcase_14 AC 44 ms
61,676 KB
testcase_15 AC 43 ms
61,876 KB
testcase_16 AC 45 ms
61,764 KB
testcase_17 AC 43 ms
61,768 KB
testcase_18 AC 51 ms
63,640 KB
testcase_19 AC 40 ms
58,772 KB
testcase_20 AC 43 ms
62,492 KB
testcase_21 AC 41 ms
61,048 KB
testcase_22 AC 48 ms
62,304 KB
testcase_23 AC 36 ms
52,268 KB
testcase_24 AC 34 ms
52,180 KB
testcase_25 AC 35 ms
51,824 KB
testcase_26 AC 33 ms
52,272 KB
testcase_27 AC 43 ms
61,760 KB
testcase_28 AC 33 ms
53,144 KB
testcase_29 AC 41 ms
61,920 KB
testcase_30 AC 34 ms
53,316 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
n = int(input())
c = list(map(int, input().split()))
v = list(map(int, input().split()))
f = [0] * (T + 1)
for i in range(n):
  g = [x for x in f]
  total, need = 0, 0
  while v[i]:
    total += v[i]
    need += c[i]
    v[i] >>= 1
    for j in range(need, T + 1):
      g[j] = max(g[j], f[j - need] + total)
  f = g
print(max(f))
0