結果

問題 No.2492 Knapsack Problem?
ユーザー たつおたつお
提出日時 2023-11-28 16:17:13
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 365 bytes
コンパイル時間 1,993 ms
コンパイル使用メモリ 172,396 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-11-28 16:17:17
合計ジャッジ時間 3,055 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(void){
//input
	int N,W; cin >> N >> W;
	int v[N],w[N];
	for (int i = 0; i < N; i++) {
		cin >> v[i] >> w[i];
	}
//calc
	vector<int> vol_v;
	for (int i = 0; i < N; i++) {
		if(w[i] <= W){
			vol_v.push_back(v[i]);
		}
	}
	sort(vol_v.begin(), vol_v.end(), greater<int>());
//output
	cout << vol_v[0] << endl;
}
0