結果

問題 No.2730 Two Types Luggage
ユーザー tkykwtnbtkykwtnb
提出日時 2024-04-19 22:16:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 793 bytes
コンパイル時間 612 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 375,312 KB
最終ジャッジ日時 2024-04-19 22:16:54
合計ジャッジ時間 25,485 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
16,384 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 30 ms
10,752 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 29 ms
10,752 KB
testcase_08 AC 30 ms
10,752 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 139 ms
19,064 KB
testcase_20 AC 652 ms
48,752 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 335 ms
33,984 KB
testcase_24 AC 821 ms
56,220 KB
testcase_25 AC 1,429 ms
99,612 KB
testcase_26 AC 355 ms
33,472 KB
testcase_27 AC 1,367 ms
88,192 KB
testcase_28 AC 682 ms
53,272 KB
testcase_29 AC 1,704 ms
112,828 KB
testcase_30 TLE -
testcase_31 AC 1,225 ms
75,788 KB
testcase_32 AC 1,017 ms
67,584 KB
testcase_33 TLE -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
権限があれば一括ダウンロードができます

ソースコード

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-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