秋祭 | 静岡高校工学部



卬高杯


提出詳細

提出id提出時刻ユーザー名問題言語判定状況判定実行時間
1149812023-10-25 08:36:19loop0919Gpython16/16AC1446

N, M = map(int, input().split())
X = list(map(int, input().split()))
Y = list(map(int, input().split()))

dp = [[0 for _ in range(M+1)] for _ in range(N+1)]

for i in range(N):
    for j in range(M):
        dp[i+1][j] = dp[i][j]
        if j >= Y[i]:
            dp[i+1][j] = max(dp[i+1][j], dp[i][j-Y[i]] + X[i])
print(max(dp[N]))

sample1.txt AC 16
case1.txt AC 25
case2.txt AC 1446
case3.txt AC 16
case4.txt AC 89
case5.txt AC 174
case6.txt AC 203
case7.txt AC 346
case8.txt AC 181
case9.txt AC 82
case10.txt AC 340
case11.txt AC 62
case12.txt AC 66
case13.txt AC 178
case14.txt AC 219
case15.txt AC 18
1446 AC