結果

問題 No.54 Happy Hallowe'en
ユーザー btkbtk
提出日時 2015-05-29 21:31:27
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 469 bytes
コンパイル時間 488 ms
コンパイル使用メモリ 64,240 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-20 15:59:29
合計ジャッジ時間 2,112 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 7 ms
4,376 KB
testcase_05 AC 11 ms
4,376 KB
testcase_06 AC 15 ms
4,376 KB
testcase_07 AC 22 ms
4,380 KB
testcase_08 AC 28 ms
4,380 KB
testcase_09 AC 35 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 34 ms
4,376 KB
testcase_13 AC 35 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 WA -
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<utility>
#include<algorithm>

using namespace std;

typedef pair<int,int> P;
P p[10010];
bool dp[20010] = {true};
int main(){
	int n;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> p[i].first >> p[i].second;
	}
	sort(p, p + n);
	for (int i = 0; i < n; i++){
		for (int j = p[i].second - 1; j >= 0; j--){
			dp[j + p[i].first] |= dp[j];
		}
	}
	int res = 0;
	for (int i = 0; i < 20010; i++){
		if (dp[i])res = i;
	}
	cout << res << endl;
}
0