結果
問題 | No.2492 Knapsack Problem? |
ユーザー |
|
提出日時 | 2023-08-31 22:44:29 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 479 bytes |
コンパイル時間 | 3,398 ms |
コンパイル使用メモリ | 249,960 KB |
最終ジャッジ日時 | 2025-02-16 15:52:10 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; struct Fast { Fast() { std::cin.tie(nullptr); ios::sync_with_stdio(false); cout << setprecision(10); } } fast; #define rep(i, a, b) for (int(i) = (a); (i) < (int)(b); (i)++) int main() { int n, wmax; cin >> n >> wmax; int ans = -1; rep(i, 0, n) { int v, w; cin >> v >> w; if (w > wmax) v = -1; ans = max(ans, v); } cout << ans << endl; }