結果

問題 No.710 チーム戦
ユーザー chocoruskchocorusk
提出日時 2018-09-20 01:16:22
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 31 ms / 3,000 ms
コード長 792 bytes
コンパイル時間 553 ms
コンパイル使用メモリ 73,456 KB
実行使用メモリ 43,072 KB
最終ジャッジ日時 2023-09-25 10:20:55
合計ジャッジ時間 2,598 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
5,128 KB
testcase_01 AC 4 ms
6,856 KB
testcase_02 AC 31 ms
43,056 KB
testcase_03 AC 30 ms
42,768 KB
testcase_04 AC 30 ms
43,068 KB
testcase_05 AC 30 ms
43,072 KB
testcase_06 AC 31 ms
42,856 KB
testcase_07 AC 31 ms
42,852 KB
testcase_08 AC 31 ms
42,848 KB
testcase_09 AC 30 ms
42,844 KB
testcase_10 AC 31 ms
42,804 KB
testcase_11 AC 30 ms
42,824 KB
testcase_12 AC 31 ms
42,880 KB
testcase_13 AC 30 ms
42,824 KB
testcase_14 AC 31 ms
42,856 KB
testcase_15 AC 31 ms
42,852 KB
testcase_16 AC 31 ms
42,940 KB
testcase_17 AC 31 ms
42,944 KB
testcase_18 AC 31 ms
42,808 KB
testcase_19 AC 31 ms
42,792 KB
testcase_20 AC 30 ms
42,780 KB
testcase_21 AC 30 ms
42,824 KB
testcase_22 AC 31 ms
42,812 KB
testcase_23 AC 30 ms
43,052 KB
testcase_24 AC 29 ms
42,784 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 3 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;
typedef long long int ll;
typedef pair<ll, int> P;
const int INF=1e9;
int main()
{
	int n;
	cin>>n;
	int a[101], b[101];
	for(int i=1; i<=n; i++){
		cin>>a[i]>>b[i];
	}
	int dp[101][100001];
	for(int i=0; i<=n; i++){
		fill(dp[i], dp[i]+100001, INF);
	}
	dp[0][0]=0;
	for(int i=1; i<=n; i++){
		for(int j=0; j<=100000-a[i]; j++){
			dp[i][j+a[i]]=dp[i-1][j];
		}
		for(int j=0; j<=100000; j++){
			dp[i][j]=min(dp[i][j], dp[i-1][j]+b[i]);
		}
	}
	int ans=1e9;
	for(int i=0; i<=100000; i++){
		ans=min(ans, max(dp[n][i], i));
	}
	cout<<ans<<endl;
	return 0;
}
0