結果

問題 No.54 Happy Hallowe'en
ユーザー
提出日時 2015-10-29 08:44:05
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 508 bytes
コンパイル時間 515 ms
コンパイル使用メモリ 64,192 KB
実行使用メモリ 4,484 KB
最終ジャッジ日時 2023-10-11 05:02:03
合計ジャッジ時間 2,148 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<algorithm>
using namespace std;
#define INF 10000000
typedef pair<int,int> P;
int main(){
	int n;
	int v[10001],t[10001];
	P s[10001];
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> v[i] >> t[i];
		s[i].first = v[i] + t[i];
		s[i].second = i;
	}
	sort(s,s+n);
	int dp[10001] ={0};
	dp[0] = 1;
	for(int i=0;i<n;i++){
		for(int j=t[s[i].second]-1;j>=0;j--){
			if(dp[j]) dp[j+v[s[i].second]] = 1;
		}
	}
	for(int i=10000;i>=0;i--){
		if(dp[i]){
			cout << i << endl;
			break;
		}
	}
}
0