結果
| 問題 | No.2492 Knapsack Problem? | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2023-10-06 21:43:46 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 342 bytes | 
| コンパイル時間 | 1,674 ms | 
| コンパイル使用メモリ | 168,560 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-07-26 15:54:31 | 
| 合計ジャッジ時間 | 1,854 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 | 
ソースコード
#include <bits/stdc++.h>
#include <math.h>
//define
#define yes (cout<<"Yes"<<endl)
#define no (cout<<"No"<<endl)
using namespace std;
int main(){
int n,k;cin>>n>>k;
vector<int> a(n),b(n);
for(int i=0;i<n;i++)cin>>a[i]>>b[i];
int ans=0;
for(int i=0;i<n;i++){
    if(b[i]<=k)ans=max(ans,a[i]);
}
if(ans)cout<<ans<<endl;
else cout<<-1<<endl;
}
            
            
            
        