結果

問題 No.37 遊園地のアトラクション
ユーザー sotanishysotanishy
提出日時 2021-08-09 14:15:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 77 ms / 5,000 ms
コード長 422 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 81,616 KB
実行使用メモリ 68,064 KB
最終ジャッジ日時 2023-10-21 11:59:30
合計ジャッジ時間 3,134 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
63,924 KB
testcase_01 AC 47 ms
61,796 KB
testcase_02 AC 63 ms
65,988 KB
testcase_03 AC 62 ms
65,960 KB
testcase_04 AC 58 ms
63,916 KB
testcase_05 AC 64 ms
66,012 KB
testcase_06 AC 59 ms
63,900 KB
testcase_07 AC 71 ms
65,976 KB
testcase_08 AC 60 ms
66,004 KB
testcase_09 AC 45 ms
59,584 KB
testcase_10 AC 77 ms
68,064 KB
testcase_11 AC 65 ms
65,976 KB
testcase_12 AC 65 ms
68,060 KB
testcase_13 AC 64 ms
65,984 KB
testcase_14 AC 57 ms
63,888 KB
testcase_15 AC 60 ms
65,964 KB
testcase_16 AC 66 ms
66,012 KB
testcase_17 AC 65 ms
65,988 KB
testcase_18 AC 68 ms
65,964 KB
testcase_19 AC 50 ms
61,800 KB
testcase_20 AC 61 ms
65,964 KB
testcase_21 AC 58 ms
63,900 KB
testcase_22 AC 68 ms
63,876 KB
testcase_23 AC 38 ms
53,500 KB
testcase_24 AC 39 ms
53,500 KB
testcase_25 AC 38 ms
53,500 KB
testcase_26 AC 39 ms
53,500 KB
testcase_27 AC 59 ms
63,916 KB
testcase_28 AC 40 ms
53,500 KB
testcase_29 AC 65 ms
68,064 KB
testcase_30 AC 39 ms
53,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

T = int(input())
N = int(input())
c = list(map(int, input().split()))
v = list(map(int, input().split()))
dp = [0] * (T+1)
for i in range(N):
    for j in range(T)[::-1]:
        k = 1
        x = v[i]
        s = x
        while j + k*c[i] <= T and x > 0:
            dp[j+k*c[i]] = max(dp[j+k*c[i]], dp[j] + s)
            x //= 2
            s += x
            k += 1
print(dp[T])
0