結果
問題 | No.1858 Gorgeous Knapsack |
ユーザー | Shirotsume |
提出日時 | 2021-12-07 12:25:23 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 428 bytes |
コンパイル時間 | 267 ms |
コンパイル使用メモリ | 86,952 KB |
実行使用メモリ | 78,160 KB |
最終ジャッジ日時 | 2023-09-17 22:17:47 |
合計ジャッジ時間 | 5,676 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 75 ms
71,220 KB |
testcase_01 | AC | 75 ms
71,112 KB |
testcase_02 | AC | 74 ms
71,420 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 73 ms
71,248 KB |
testcase_20 | AC | 74 ms
71,420 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 73 ms
71,140 KB |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | AC | 75 ms
71,256 KB |
testcase_38 | AC | 106 ms
77,912 KB |
testcase_39 | AC | 72 ms
71,300 KB |
testcase_40 | WA | - |
ソースコード
def solve(n, m, vw): ans = 0 vw.sort(key = lambda x: x[0] / x[1], reverse = True) b = 0 va = 0 mn = 10 ** 18 for i in range(n): b += vw[i][1] if b >= m: break va += vw[i][0] mn = min(vw[i][0], mn) ans = max(ans, va * mn) return ans n, m = map(int,input().split()) vw = [list(map(int,input().split())) for _ in range(n)] print(solve(n, m, vw))