結果

問題 No.37 遊園地のアトラクション
ユーザー 👑 rin204rin204
提出日時 2022-07-06 07:11:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 88 ms / 5,000 ms
コード長 278 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 76,108 KB
最終ジャッジ日時 2023-08-22 22:34:33
合計ジャッジ時間 4,681 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
76,048 KB
testcase_01 AC 79 ms
75,936 KB
testcase_02 AC 84 ms
75,796 KB
testcase_03 AC 87 ms
76,108 KB
testcase_04 AC 81 ms
76,020 KB
testcase_05 AC 83 ms
76,048 KB
testcase_06 AC 82 ms
75,868 KB
testcase_07 AC 88 ms
76,004 KB
testcase_08 AC 84 ms
76,012 KB
testcase_09 AC 81 ms
76,020 KB
testcase_10 AC 87 ms
75,992 KB
testcase_11 AC 86 ms
75,876 KB
testcase_12 AC 85 ms
75,796 KB
testcase_13 AC 85 ms
76,052 KB
testcase_14 AC 84 ms
76,032 KB
testcase_15 AC 86 ms
75,804 KB
testcase_16 AC 84 ms
75,892 KB
testcase_17 AC 83 ms
75,796 KB
testcase_18 AC 87 ms
76,024 KB
testcase_19 AC 81 ms
75,976 KB
testcase_20 AC 84 ms
76,080 KB
testcase_21 AC 83 ms
75,792 KB
testcase_22 AC 87 ms
75,852 KB
testcase_23 AC 73 ms
70,948 KB
testcase_24 AC 72 ms
71,280 KB
testcase_25 AC 72 ms
71,464 KB
testcase_26 AC 73 ms
71,152 KB
testcase_27 AC 84 ms
76,052 KB
testcase_28 AC 73 ms
71,208 KB
testcase_29 AC 83 ms
75,876 KB
testcase_30 AC 72 ms
71,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())
n = int(input())
C = list(map(int, input().split()))
V = list(map(int, input().split()))
dp = [0] * (t + 1)
for c, v in zip(C, V):
    while v > 0:
        for i in range(t, c - 1, -1):
            dp[i] = max(dp[i], dp[i - c] + v)
        v >>= 1
print(dp[-1])
0