結果
問題 |
No.2492 Knapsack Problem?
|
ユーザー |
|
提出日時 | 2023-10-13 12:20:28 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 294 bytes |
コンパイル時間 | 1,695 ms |
コンパイル使用メモリ | 164,940 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-15 09:14:44 |
合計ジャッジ時間 | 2,295 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 |
ソースコード
#include <bits/stdc++.h> using namespace std; int n, w; int main() { ios::sync_with_stdio(0); cin.tie(0); cin.exceptions(cin.failbit); cin >> n >> w; int ans = -1; for (int i = 1, a, b; i <= n; i++) { cin >> a >> b; if (b < w) { ans = max(ans, a); } } cout << ans; return 0; }