結果

問題 No.2730 Two Types Luggage
ユーザー tkykwtnbtkykwtnb
提出日時 2024-04-19 22:10:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 778 bytes
コンパイル時間 525 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 254,828 KB
最終ジャッジ日時 2024-04-19 22:11:22
合計ジャッジ時間 12,896 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
51,968 KB
testcase_01 AC 41 ms
51,968 KB
testcase_02 AC 42 ms
57,472 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 RE -
testcase_08 RE -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 RE -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,W=map(int,input().split())
A=list(map(int,input().split()))
A.sort(reverse=True)
B=[0]+list(map(int,input().split()))
C=[0]+list(map(int,input().split()))
D=[]
for b,c in zip(B,C):
    D.append([b,c])
D.sort()
j=0
for i in range(M+1):
    w=0;v=0
    while j<N and w<D[i][0]:
        w+=1;v+=A[j]
        j+=1
    if v>D[i][1]:
        D[i][1]=v
        for k in range(D[i][0]):
            A[j-k-1]=0
A.sort(reverse=True)
dp=[set() for _ in range(21)]
dp[0].add((0,0))
for i in range(M):
    for w,v in list(dp[i]):
        dp[i+1].add((w,v))
        if w+D[i+1][0]<=W:dp[i+1].add((w+D[i+1][0],v+D[i+1][1]))
ans_w=0
ans_v=0
for w,v in list(dp[M]):
    if v>ans_v:
        ans_w=w
        ans_v=v
i=0
while i<N and ans_w<W:
    ans_w+=1
    ans_v+=A[i]
    i+=1
print(ans_v)
0