結果

問題 No.37 遊園地のアトラクション
ユーザー brthyyjpbrthyyjp
提出日時 2021-11-05 01:32:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 57 ms / 5,000 ms
コード長 467 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 66,176 KB
最終ジャッジ日時 2024-04-23 08:18:37
合計ジャッジ時間 2,603 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
60,416 KB
testcase_01 AC 36 ms
58,112 KB
testcase_02 AC 47 ms
64,256 KB
testcase_03 AC 47 ms
63,488 KB
testcase_04 AC 48 ms
63,360 KB
testcase_05 AC 53 ms
64,768 KB
testcase_06 AC 41 ms
61,056 KB
testcase_07 AC 50 ms
65,152 KB
testcase_08 AC 41 ms
59,392 KB
testcase_09 AC 38 ms
58,112 KB
testcase_10 AC 57 ms
64,768 KB
testcase_11 AC 54 ms
65,664 KB
testcase_12 AC 47 ms
62,592 KB
testcase_13 AC 48 ms
63,104 KB
testcase_14 AC 41 ms
59,648 KB
testcase_15 AC 52 ms
64,512 KB
testcase_16 AC 47 ms
63,744 KB
testcase_17 AC 44 ms
63,232 KB
testcase_18 AC 49 ms
65,920 KB
testcase_19 AC 35 ms
58,368 KB
testcase_20 AC 46 ms
64,640 KB
testcase_21 AC 36 ms
59,136 KB
testcase_22 AC 46 ms
65,664 KB
testcase_23 AC 34 ms
51,968 KB
testcase_24 AC 36 ms
52,608 KB
testcase_25 AC 32 ms
51,968 KB
testcase_26 AC 32 ms
51,840 KB
testcase_27 AC 51 ms
66,176 KB
testcase_28 AC 34 ms
51,840 KB
testcase_29 AC 46 ms
64,128 KB
testcase_30 AC 33 ms
52,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())
n = int(input())
C = list(map(int, input().split()))
V = list(map(int, input().split()))
dp = [-1]*(t+1)
dp[0] = 0
for c, v in zip(C, V):
    for i in reversed(range(t+1)):
        if dp[i] == -1:
            continue
        j = i+c
        cur = v
        s = v
        while j <= t:
            dp[j] = max(dp[j], dp[i]+s)
            j += c
            cur //= 2
            s += cur
            if cur == 0:
                break
print(max(dp))
0