結果

問題 No.2492 Knapsack Problem?
ユーザー porkleoiporkleoi
提出日時 2023-10-06 21:27:56
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 2,437 bytes
コンパイル時間 3,008 ms
コンパイル使用メモリ 241,732 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-10-06 21:28:01
合計ジャッジ時間 3,544 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,384 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = s; i <= (ll)(n); i++)
#define rep3(i, s, n, d) for (ll i = s; i <= (ll)(n); i += d)
#define rep4(i, s, n, d) for (ll i = s; i >= (ll)(n); i += d)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vvvi> vvvvi;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<vvc> vvvc;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<vvvll> vvvvll;
typedef vector<vvvvll> vvvvvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<bool> vb;
typedef vector<vd> vvb;
typedef vector<vvd> vvvb;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<int, vector<int>, greater<int>> pqi;
typedef priority_queue<vi, vector<vi>, greater<vi>> pqvi;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqll;
typedef priority_queue<vll, vector<vll>, greater<vll>> pqvll;
typedef priority_queue<int, vector<int>, less<int>> rpqi;
typedef priority_queue<vi, vector<vi>, less<vi>> rpqvi;
typedef pair<int, int> P;
#define yes(ans) if(ans)cout << "yes"<< endl; else cout << "no" << endl
#define Yes(ans) if(ans)cout << "Yes"<< endl; else cout << "No" << endl
#define YES(ans) if(ans)cout << "YES"<< endl ;else cout << "NO" << endl
#define printv(vec) rep(i, vec.size()) cout << vec[i] << ' ';
#define printvv(vec) rep(i, vec.size()) {rep(j, vec[i].size()) cout << vec[i][j] << ' '; cout << endl;};
#define printvvv(vec) rep(i, vec.size()) { rep(j, vec[i].size()) { rep(k, vec[i][j].size()) cout << vec[i][j][k] << ' '; cout << "	"; }cout << endl; };
#define all1(x) x.begin(),x.end()
#define all2(x) x.rbegin(), x.rend()
#define so(x) sort(all1(x))
#define re(x) reverse(all1(x))
#define rso(x) sort(all2(x))
#define vco(x, a) count(all1(x), a)
#define per(x) next_permutation(all1(x))
#define iINF 2147483647
#define llINF 9223372036854775807
#define mod 998244353
#define mod2 1000000007

int main() {
	int n, w; cin >> n >> w;
	int ans = -1;
	rep(i, n) {
		int x, y; cin >> x >> y;
		if (y > w) continue;
		ans = max(ans, x);
	}
	cout << ans << endl;
}
0