結果

問題 No.2492 Knapsack Problem?
ユーザー hiro1729
提出日時 2023-09-06 19:02:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 58 ms / 2,000 ms
コード長 315 bytes
コンパイル時間 142 ms
コンパイル使用メモリ 82,252 KB
実行使用メモリ 61,824 KB
最終ジャッジ日時 2024-07-26 15:34:11
合計ジャッジ時間 1,173 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

n, w = map(int, input().split())
assert(1 <= n <= 1000)
assert(1 <= w <= 1000)
V = [0] * n
W = [0] * n
for i in range(n):
	V[i], W[i] = map(int, input().split())
	assert(1 <= V[i] <= 1000)
	assert(1 <= W[i] <= 1000)
maxw = 0
ans = -1
for i in range(n):
	if W[i] <= w:
		maxw = W[i]
		ans = max(ans, V[i])
print(ans)
0