結果
| 問題 |
No.2730 Two Types Luggage
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-19 22:16:04 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 793 bytes |
| コンパイル時間 | 157 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 368,112 KB |
| 最終ジャッジ日時 | 2024-10-11 15:41:43 |
| 合計ジャッジ時間 | 29,540 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 WA * 16 TLE * 2 -- * 4 |
ソースコード
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)