結果

問題 No.2492 Knapsack Problem?
ユーザー Ekiben542Ekiben542
提出日時 2024-01-20 20:04:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 236 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 63,752 KB
最終ジャッジ日時 2024-01-20 20:04:04
合計ジャッジ時間 1,809 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,332 KB
testcase_01 AC 39 ms
53,332 KB
testcase_02 AC 39 ms
53,332 KB
testcase_03 AC 36 ms
53,332 KB
testcase_04 AC 37 ms
53,332 KB
testcase_05 AC 37 ms
53,332 KB
testcase_06 AC 42 ms
55,460 KB
testcase_07 AC 42 ms
55,460 KB
testcase_08 AC 43 ms
55,460 KB
testcase_09 AC 55 ms
63,752 KB
testcase_10 AC 54 ms
63,752 KB
testcase_11 AC 53 ms
63,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, W = map(int, input().split())
vw = [list(map(int, input().split())) for _ in range(N)]

max_v = 0
for i in range(N):
    if vw[i][1] <= W:
        max_v = max(max_v, vw[i][0])

if max_v == 0:
    print(-1)
else:
    print(max_v)




0