結果

問題 No.2492 Knapsack Problem?
ユーザー V_MelvilleV_Melville
提出日時 2023-10-13 21:37:41
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 365 bytes
コンパイル時間 2,872 ms
コンパイル使用メモリ 242,124 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-15 17:14:20
合計ジャッジ時間 3,562 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int n, W;
    cin >> n >> W;
    
    int ans = -1;
    rep(i, n) {
        int v, w;
        cin >> v >> w;
        if (w <= W) ans = max(ans, v);
    }
    
    cout << ans << '\n';
    
    return 0;
}
0