結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,452 KB
testcase_01 AC 38 ms
53,452 KB
testcase_02 AC 37 ms
53,452 KB
testcase_03 RE -
testcase_04 AC 47 ms
61,700 KB
testcase_05 AC 46 ms
61,700 KB
testcase_06 AC 48 ms
61,704 KB
testcase_07 AC 49 ms
61,700 KB
testcase_08 WA -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 WA -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 135 ms
66,536 KB
testcase_30 WA -
testcase_31 AC 38 ms
53,456 KB
testcase_32 AC 38 ms
53,456 KB
testcase_33 AC 42 ms
59,516 KB
testcase_34 RE -
testcase_35 RE -
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)
    ans=max(ans,ct+d[V-b])
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