結果

問題 No.1858 Gorgeous Knapsack
ユーザー pluto77pluto77
提出日時 2022-03-04 10:22:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 255 ms / 2,000 ms
コード長 269 bytes
コンパイル時間 1,118 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 78,296 KB
最終ジャッジ日時 2023-09-25 09:20:17
合計ジャッジ時間 6,894 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,204 KB
testcase_01 AC 74 ms
71,464 KB
testcase_02 AC 75 ms
71,392 KB
testcase_03 AC 85 ms
76,028 KB
testcase_04 AC 138 ms
78,020 KB
testcase_05 AC 103 ms
76,280 KB
testcase_06 AC 129 ms
78,088 KB
testcase_07 AC 123 ms
77,956 KB
testcase_08 AC 160 ms
78,044 KB
testcase_09 AC 182 ms
77,976 KB
testcase_10 AC 133 ms
77,964 KB
testcase_11 AC 132 ms
78,232 KB
testcase_12 AC 146 ms
78,108 KB
testcase_13 AC 124 ms
78,240 KB
testcase_14 AC 79 ms
75,848 KB
testcase_15 AC 80 ms
71,236 KB
testcase_16 AC 79 ms
75,752 KB
testcase_17 AC 75 ms
71,440 KB
testcase_18 AC 74 ms
71,092 KB
testcase_19 AC 79 ms
71,604 KB
testcase_20 AC 75 ms
71,396 KB
testcase_21 AC 76 ms
71,464 KB
testcase_22 AC 73 ms
71,228 KB
testcase_23 AC 74 ms
71,336 KB
testcase_24 AC 94 ms
76,668 KB
testcase_25 AC 151 ms
78,116 KB
testcase_26 AC 132 ms
77,800 KB
testcase_27 AC 140 ms
78,024 KB
testcase_28 AC 129 ms
78,144 KB
testcase_29 AC 109 ms
77,876 KB
testcase_30 AC 112 ms
78,296 KB
testcase_31 AC 110 ms
78,004 KB
testcase_32 AC 113 ms
78,032 KB
testcase_33 AC 113 ms
77,984 KB
testcase_34 AC 222 ms
78,060 KB
testcase_35 AC 107 ms
77,960 KB
testcase_36 AC 255 ms
78,112 KB
testcase_37 AC 73 ms
71,604 KB
testcase_38 AC 106 ms
77,968 KB
testcase_39 AC 76 ms
75,776 KB
testcase_40 AC 109 ms
78,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki1858
n,m=map(int,input().split())
l=[]
for i in range(n):
 l.append(list(map(int,input().split())))
l.sort(key=lambda x:x[0],reverse=True)
res=0
dp=[0]*(m+1)
for v,w in l:
 for i in range(m-w,-1,-1):
  dp[i+w]=max(dp[i+w],dp[i]+v)
 res=max(res,v*dp[m])
print(res)
0