結果
問題 | No.2492 Knapsack Problem? |
ユーザー |
![]() |
提出日時 | 2023-10-06 21:22:15 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 284 bytes |
コンパイル時間 | 557 ms |
コンパイル使用メモリ | 65,280 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-26 15:37:40 |
合計ジャッジ時間 | 1,073 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 |
ソースコード
#include <iostream> #include <algorithm> using namespace std; int n, W; int v[1000], w[10000]; int main() { cin >> n >> W; int ans = -1; for (int i = 0; i < n; i++) { cin >> v[i] >> w[i]; if (w[i] <= W) { ans = max(v[i], ans); } } cout << ans << endl; return 0; }