結果

問題 No.37 遊園地のアトラクション
ユーザー kohei2019kohei2019
提出日時 2021-02-18 03:09:18
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 518 bytes
コンパイル時間 383 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 71,424 KB
最終ジャッジ日時 2024-04-18 20:24:03
合計ジャッジ時間 2,955 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
62,848 KB
testcase_01 WA -
testcase_02 AC 56 ms
63,104 KB
testcase_03 AC 57 ms
64,256 KB
testcase_04 AC 55 ms
62,464 KB
testcase_05 AC 58 ms
63,360 KB
testcase_06 AC 56 ms
62,720 KB
testcase_07 AC 72 ms
69,504 KB
testcase_08 AC 53 ms
62,464 KB
testcase_09 AC 53 ms
61,952 KB
testcase_10 AC 69 ms
68,224 KB
testcase_11 AC 66 ms
67,540 KB
testcase_12 AC 56 ms
63,488 KB
testcase_13 AC 57 ms
63,616 KB
testcase_14 AC 53 ms
62,592 KB
testcase_15 AC 55 ms
63,104 KB
testcase_16 AC 60 ms
65,024 KB
testcase_17 AC 58 ms
64,640 KB
testcase_18 AC 73 ms
69,248 KB
testcase_19 AC 53 ms
62,720 KB
testcase_20 AC 59 ms
63,872 KB
testcase_21 AC 52 ms
62,336 KB
testcase_22 AC 75 ms
71,424 KB
testcase_23 AC 40 ms
52,096 KB
testcase_24 AC 40 ms
51,712 KB
testcase_25 AC 43 ms
51,712 KB
testcase_26 AC 40 ms
52,352 KB
testcase_27 AC 56 ms
63,232 KB
testcase_28 AC 50 ms
61,056 KB
testcase_29 AC 55 ms
62,720 KB
testcase_30 AC 41 ms
52,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
N = int(input())
lsc = list(map(int,input().split()))
lsv = list(map(int,input().split()))
lsvc = []
for i in range(N):
    c = lsc[i]
    v = lsv[i]
    while v > 0:
        lsvc.append([c,v])
        v //= 2
N = len(lsvc)
dp = [[0]*(T+1) for i in range(N+1)]
for i in range(N):
    for j in range(T+1):
        if j + lsvc[i][0] <= T:
            dp[i+1][j + lsvc[i][0]] = max(dp[i][j + lsvc[i][0]],dp[i][j]+lsvc[i][1])
        else:
            dp[i+1][j] = max(dp[i+1][j],dp[i][j])
print(dp[N][T])
0