結果
| 問題 | 
                            No.2492 Knapsack Problem?
                             | 
                    
| コンテスト | |
| ユーザー | 
                             nono00
                         | 
                    
| 提出日時 | 2023-10-06 21:21:42 | 
| 言語 | C++23  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 492 bytes | 
| コンパイル時間 | 2,744 ms | 
| コンパイル使用メモリ | 243,204 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-26 15:36:52 | 
| 合計ジャッジ時間 | 3,290 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 | 
ソースコード
#include <bits/stdc++.h>
namespace nono {
void solve() {
    int n, w;
    std::cin >> n >> w;
    int ans = -1;
    for (int i = 0; i < n; i++) {
        int a, b;
        std::cin >> a >> b;
        if (b <= w) {
            ans = std::max(ans, a);
        }
    }
    std::cout << ans << std::endl;
}
}  //  namespace nono
int main() {
    std::cin.tie(0)->sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    int t = 1;
    while (t--) nono::solve();
}
            
            
            
        
            
nono00