結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,380 KB
testcase_01 AC 37 ms
53,380 KB
testcase_02 AC 37 ms
53,380 KB
testcase_03 AC 36 ms
53,380 KB
testcase_04 AC 44 ms
59,472 KB
testcase_05 AC 45 ms
59,488 KB
testcase_06 AC 43 ms
59,472 KB
testcase_07 AC 44 ms
59,472 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 47 ms
61,540 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 154 ms
66,504 KB
testcase_30 AC 162 ms
66,508 KB
testcase_31 AC 40 ms
53,384 KB
testcase_32 AC 40 ms
53,384 KB
testcase_33 AC 50 ms
59,476 KB
testcase_34 AC 58 ms
66,520 KB
testcase_35 AC 52 ms
64,332 KB
testcase_36 AC 162 ms
66,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ans=0
n,V,c,*a=map(int,open(0).read().split())
d=[0]*-~V
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
    for i in range(V-v+1):
        d[i+v]=max(d[i+v],d[i]+w)
    W+=w
    if V-b>=0:ans=max(ans,ct+W+d[V-b])
print(ans)
0