結果
| 問題 | No.3014 岩井満足性問題 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-01-25 13:08:59 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 832 bytes |
| 記録 | |
| コンパイル時間 | 242 ms |
| コンパイル使用メモリ | 81,836 KB |
| 実行使用メモリ | 89,520 KB |
| 最終ジャッジ日時 | 2025-01-25 22:34:14 |
| 合計ジャッジ時間 | 4,109 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 RE * 2 |
| other | AC * 3 RE * 15 |
ソースコード
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()))
dd = c[:]
dd.sort(reverse=True)
if sum(dd[:d]) < k:
exit(print('No'))
dp = [[-10**18 for i in range(k+1)] for j in range(d+1)]
dp[0][0][0] = 0
for i in range(n):
ndp = [[-10**18 for i in range(k+1)] for j in range(d+1)]
for j in range(d):
for l in range(k+1):
ndp[j][l] = dp[i][j][l]
ndp[j+1][min(k,l+c[i])] = max(ndp[j+1][min(k,l+c[i])],dp[j][l] + a[i])
dp = ndp
print(dp[d][k])