結果

問題 No.2730 Two Types Luggage
ユーザー tkykwtnbtkykwtnb
提出日時 2024-04-19 23:03:48
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 819 bytes
コンパイル時間 212 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 351,384 KB
最終ジャッジ日時 2024-04-19 23:04:08
合計ジャッジ時間 15,181 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
51,840 KB
testcase_01 AC 36 ms
51,840 KB
testcase_02 AC 39 ms
57,600 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 36 ms
52,096 KB
testcase_08 AC 39 ms
52,096 KB
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 AC 71 ms
79,872 KB
testcase_20 AC 214 ms
132,356 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 107 ms
93,692 KB
testcase_24 AC 255 ms
156,180 KB
testcase_25 AC 373 ms
208,140 KB
testcase_26 AC 129 ms
102,272 KB
testcase_27 AC 350 ms
203,736 KB
testcase_28 AC 204 ms
141,072 KB
testcase_29 AC 446 ms
232,624 KB
testcase_30 AC 642 ms
270,724 KB
testcase_31 AC 316 ms
169,360 KB
testcase_32 AC 273 ms
173,964 KB
testcase_33 AC 1,001 ms
351,384 KB
testcase_34 AC 981 ms
335,892 KB
testcase_35 AC 1,024 ms
347,276 KB
testcase_36 AC 989 ms
349,976 KB
testcase_37 AC 992 ms
348,164 KB
権限があれば一括ダウンロードができます

ソースコード

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 w==D[i][0] and v>D[i][1]:
        D[i][1]=v
        for k in range(D[i][0]):
            A[j-1-k]=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 or (v==ans_v and w<ans_w):
        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