結果

問題 No.1947 質より種類数
ユーザー KeroruKeroru
提出日時 2022-05-20 22:44:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 326 bytes
コンパイル時間 218 ms
コンパイル使用メモリ 81,692 KB
実行使用メモリ 66,608 KB
最終ジャッジ日時 2023-10-20 13:33:31
合計ジャッジ時間 4,142 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,424 KB
testcase_01 AC 37 ms
53,424 KB
testcase_02 AC 37 ms
53,424 KB
testcase_03 AC 37 ms
53,424 KB
testcase_04 AC 47 ms
61,676 KB
testcase_05 AC 44 ms
59,628 KB
testcase_06 AC 48 ms
61,680 KB
testcase_07 AC 46 ms
61,676 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 47 ms
61,676 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 242 ms
66,476 KB
testcase_30 WA -
testcase_31 AC 38 ms
53,424 KB
testcase_32 AC 38 ms
53,424 KB
testcase_33 AC 43 ms
59,492 KB
testcase_34 AC 52 ms
66,472 KB
testcase_35 AC 49 ms
64,292 KB
testcase_36 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

ans=0
n,V,c,*a=map(int,open(0).read().split())
d=[0]*-~V
b=ct=0
for v,w in zip(a[::2],a[1::2]):
    b+=v
    ct+=c
    for i in range(V-v+1):
        d[i+v]=max(d[i+v],d[i]+c*0+w)

b=ct=W=0
for v,w in sorted(zip(a[::2],a[1::2]),key=lambda x:x[0]):
    b+=v
    ct+=c
    W+=w
    if V-b>=0:ans=max(ans,ct+W+d[V-b])
print(ans)
0