結果

問題 No.1947 質より種類数
ユーザー KeroruKeroru
提出日時 2022-05-20 22:46:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 333 bytes
コンパイル時間 1,136 ms
コンパイル使用メモリ 81,576 KB
実行使用メモリ 72,760 KB
最終ジャッジ日時 2023-10-20 13:35:51
合計ジャッジ時間 4,012 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,444 KB
testcase_01 AC 36 ms
53,444 KB
testcase_02 AC 36 ms
53,444 KB
testcase_03 AC 37 ms
53,444 KB
testcase_04 AC 43 ms
61,684 KB
testcase_05 AC 43 ms
61,688 KB
testcase_06 AC 46 ms
61,692 KB
testcase_07 AC 43 ms
61,688 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 46 ms
61,688 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 226 ms
68,552 KB
testcase_30 AC 140 ms
66,504 KB
testcase_31 AC 36 ms
53,444 KB
testcase_32 AC 36 ms
53,444 KB
testcase_33 AC 40 ms
59,504 KB
testcase_34 AC 50 ms
66,500 KB
testcase_35 AC 47 ms
66,368 KB
testcase_36 AC 142 ms
66,504 KB
権限があれば一括ダウンロードができます

ソースコード

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],-x[1])):
    b+=v
    ct+=c
    W+=w
    if V-b>=0:ans=max(ans,ct+W+d[V-b])
print(ans)
0