結果
| 問題 |
No.2492 Knapsack Problem?
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-10-06 21:56:01 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 662 bytes |
| コンパイル時間 | 1,608 ms |
| コンパイル使用メモリ | 172,836 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-26 16:03:47 |
| 合計ジャッジ時間 | 2,158 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
typedef long long ll;
typedef unsigned long long ull;
const int MAX = 1e9;
const int MIN = -1*1e9;
const ll MAXLL = 1e18;
const ll MINLL = -1*1e18;
//const ll MOD = 998244353;
//const ll MOD = 1000000007;
int main()
{
int N,M; cin >> N >> M;
vector<pair<int,int>> P(N);
for(int i = 0; i < N; i++)
{
cin >> P[i].second >> P[i].first;
}
sort(P.begin(),P.end());
int Ans = -1;
for(int i = 0; i < N; i++)
{
if(P[i].first > M) break;
Ans = max(Ans,P[i].second);
}
cout << Ans << endl;
return 0;
}