結果

問題 No.3014 岩井満足性問題
ユーザー hato336
提出日時 2025-01-25 12:53:03
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 782 bytes
コンパイル時間 448 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 859,544 KB
最終ジャッジ日時 2025-01-25 22:25:40
合計ジャッジ時間 18,472 ms
ジャッジサーバーID
(参考情報)
judge3 / judge9
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 WA * 5 TLE * 1 MLE * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#sys.setrecursionlimit(10**9)
#sys.set_int_max_str_digits(0)
#input = sys.stdin.readline
#n = int(input())
#
#alist = []
#s = input()
n,d,k = map(int,input().split())
#for i in range(n):
#    alist.append(list(map(int,input().split())))
a = list(map(int,input().split()))
c = list(map(int,input().split()))
dp = [[[-10**18 for i in range(k+1)] for j in range(d+1)] for wufhe2u in range(n+1)]
dp[0][0][0] = 0
for i in range(n):
    for j in range(d):
        for l in range(k+1):
            dp[i+1][j][l] = max(dp[i+1][j][l],dp[i][j][l])
            dp[i+1][j+1][min(k,l+c[i])] = max(dp[i+1][j+1][min(k,l+c[i])],dp[i][j][l] + a[i])
print(dp[n][d][k] if dp[n][d][k] > -10**14 else 'No')
0