結果
問題 | No.2492 Knapsack Problem? |
ユーザー |
![]() |
提出日時 | 2023-10-08 16:32:42 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 459 bytes |
コンパイル時間 | 411 ms |
コンパイル使用メモリ | 40,644 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-26 18:08:54 |
合計ジャッジ時間 | 1,089 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 |
ソースコード
/* -*- coding: utf-8 -*- * * 2492.cc: No.2492 Knapsack Problem? - yukicoder */ #include<cstdio> #include<algorithm> using namespace std; /* constant */ /* typedef */ /* global variables */ /* subroutines */ /* main */ int main() { int n, w; scanf("%d%d", &n, &w); int maxv = -1; for (int i = 0; i < n; i++) { int vi, wi; scanf("%d%d", &vi, &wi); if (wi <= w) maxv = max(maxv, vi); } printf("%d\n", maxv); return 0; }