結果

問題 No.710 チーム戦
ユーザー amtgjwamtgjw
提出日時 2018-07-11 11:48:08
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 15 ms / 3,000 ms
コード長 885 bytes
コンパイル時間 788 ms
コンパイル使用メモリ 81,100 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-17 06:48:40
合計ジャッジ時間 2,699 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,348 KB
testcase_01 AC 3 ms
4,348 KB
testcase_02 AC 15 ms
4,348 KB
testcase_03 AC 15 ms
4,348 KB
testcase_04 AC 15 ms
4,348 KB
testcase_05 AC 15 ms
4,348 KB
testcase_06 AC 15 ms
4,348 KB
testcase_07 AC 15 ms
4,348 KB
testcase_08 AC 15 ms
4,348 KB
testcase_09 AC 15 ms
4,348 KB
testcase_10 AC 15 ms
4,348 KB
testcase_11 AC 15 ms
4,348 KB
testcase_12 AC 15 ms
4,348 KB
testcase_13 AC 15 ms
4,348 KB
testcase_14 AC 15 ms
4,348 KB
testcase_15 AC 15 ms
4,348 KB
testcase_16 AC 15 ms
4,348 KB
testcase_17 AC 15 ms
4,348 KB
testcase_18 AC 15 ms
4,348 KB
testcase_19 AC 15 ms
4,348 KB
testcase_20 AC 15 ms
4,348 KB
testcase_21 AC 15 ms
4,348 KB
testcase_22 AC 14 ms
4,348 KB
testcase_23 AC 15 ms
4,348 KB
testcase_24 AC 15 ms
4,348 KB
testcase_25 AC 2 ms
4,348 KB
testcase_26 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <math.h>
#include <cstring>

using namespace std;

#define REP(i,n)	for(int i=0;i<(n);++i)
#define REPS(i,s,t)	for(int i=(s);i<(t);++i)

#define INF 		2000000007
#define MOD			998244353

#define MAX 		100005

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int ll;

int dp[MAX];

int main(){
	int n;cin>>n;
	vector<int> a(n),b(n);
	REP(i,n)cin>>a[i]>>b[i];

	memset(dp,-1,MAX);

	dp[0]=0;
	REP(i,n){
		for(int j=MAX-1;j>=a[i];--j){
			if(dp[j-a[i]]==-1)continue;
			dp[j] = max(dp[j-a[i]]+b[i],dp[j]);
		}
	}
	int sumb = 0;
	REP(i,n)sumb+=b[i];
	int ans = INF;
	REP(i,MAX){
		ans = min(ans,max(i,sumb - dp[i]));
	}

	//REP(i,MAX)if(dp[i]>0)cout << i <<" " << dp[i] << endl;
	
	cout << ans << endl;

	return 0;
}
0