結果
| 問題 | No.710 チーム戦 | 
| コンテスト | |
| ユーザー |  rapurasu | 
| 提出日時 | 2018-07-13 10:00:20 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 14 ms / 3,000 ms | 
| コード長 | 800 bytes | 
| コンパイル時間 | 1,262 ms | 
| コンパイル使用メモリ | 159,952 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-07 05:19:21 | 
| 合計ジャッジ時間 | 2,451 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 25 | 
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;
int A[101];
int B[101];
int dp[100011];
int pre[100011];
int main(){
	cin>>N;
	int s=0;
	REP(i,N){
		cin>>A[i]>>B[i];
		s+=B[i];
	}
	REP(i,100011){
		dp[i]=s;
	}
	//cout<<s<<endl;
	REP(i,N){
		REP(j,100011){
			pre[j]=dp[j];
		}
		REP(j,100011){
			if(j+A[i]<100001){
				dp[j+A[i]]=min(dp[j+A[i]],pre[j]-B[i]);
			}
		}
		/*REP(j,101){
			cout<<dp[j]<<endl;
		}
		cout<<"end"<<endl;*/
	}
	
	int ans=1e7;
	REP(i,100011){
		/*if(ans>max(dp[i],i)){
			cout<<i<<" "<<dp[i]<<endl;
		}*/
		ans=min(ans,max(dp[i],i));
	}
	cout<<ans<<endl;
	return(0);
}
            
            
            
        