結果
問題 |
No.3014 岩井満足性問題
|
ユーザー |
|
提出日時 | 2025-01-25 13:11:07 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 829 bytes |
コンパイル時間 | 237 ms |
コンパイル使用メモリ | 82,288 KB |
実行使用メモリ | 90,216 KB |
最終ジャッジ日時 | 2025-01-25 22:36:29 |
合計ジャッジ時間 | 4,500 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 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])