結果

問題 No.37 遊園地のアトラクション
ユーザー convexineqconvexineq
提出日時 2020-12-08 09:06:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 61 ms / 5,000 ms
コード長 258 bytes
コンパイル時間 217 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 62,464 KB
最終ジャッジ日時 2024-04-18 20:21:52
合計ジャッジ時間 2,732 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
60,032 KB
testcase_01 AC 42 ms
58,112 KB
testcase_02 AC 51 ms
61,440 KB
testcase_03 AC 52 ms
61,312 KB
testcase_04 AC 49 ms
59,776 KB
testcase_05 AC 52 ms
61,952 KB
testcase_06 AC 46 ms
60,800 KB
testcase_07 AC 53 ms
62,208 KB
testcase_08 AC 48 ms
61,184 KB
testcase_09 AC 44 ms
59,520 KB
testcase_10 AC 52 ms
61,952 KB
testcase_11 AC 51 ms
62,464 KB
testcase_12 AC 48 ms
61,696 KB
testcase_13 AC 52 ms
61,824 KB
testcase_14 AC 52 ms
61,568 KB
testcase_15 AC 57 ms
61,824 KB
testcase_16 AC 55 ms
62,080 KB
testcase_17 AC 49 ms
61,184 KB
testcase_18 AC 58 ms
61,312 KB
testcase_19 AC 52 ms
60,032 KB
testcase_20 AC 55 ms
61,440 KB
testcase_21 AC 51 ms
61,312 KB
testcase_22 AC 55 ms
59,904 KB
testcase_23 AC 41 ms
51,584 KB
testcase_24 AC 37 ms
51,328 KB
testcase_25 AC 36 ms
52,096 KB
testcase_26 AC 41 ms
51,456 KB
testcase_27 AC 56 ms
62,080 KB
testcase_28 AC 44 ms
52,096 KB
testcase_29 AC 61 ms
61,056 KB
testcase_30 AC 44 ms
51,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())
n = int(input())
*c, = map(int,input().split())
*v, = map(int,input().split())
dp = [0]*(1+t)
for ci,vi in zip(c,v):
    while vi:
        for i in range(t,ci-1,-1):
            dp[i] = max(dp[i], dp[i-ci]+vi)
        vi //= 2
print(max(dp))
0