結果

問題 No.710 チーム戦
ユーザー ace_amuroace_amuro
提出日時 2023-04-13 14:57:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 24 ms / 3,000 ms
コード長 738 bytes
コンパイル時間 724 ms
コンパイル使用メモリ 82,912 KB
実行使用メモリ 43,136 KB
最終ジャッジ日時 2024-04-17 18:41:10
合計ジャッジ時間 2,410 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
43,008 KB
testcase_01 AC 12 ms
42,864 KB
testcase_02 AC 24 ms
43,136 KB
testcase_03 AC 23 ms
43,116 KB
testcase_04 AC 24 ms
42,880 KB
testcase_05 AC 22 ms
43,100 KB
testcase_06 AC 22 ms
43,004 KB
testcase_07 AC 24 ms
42,880 KB
testcase_08 AC 23 ms
42,944 KB
testcase_09 AC 23 ms
42,880 KB
testcase_10 AC 24 ms
42,868 KB
testcase_11 AC 23 ms
43,008 KB
testcase_12 AC 23 ms
42,920 KB
testcase_13 AC 22 ms
43,008 KB
testcase_14 AC 23 ms
43,020 KB
testcase_15 AC 23 ms
42,956 KB
testcase_16 AC 24 ms
42,880 KB
testcase_17 AC 24 ms
43,032 KB
testcase_18 AC 24 ms
43,136 KB
testcase_19 AC 23 ms
43,008 KB
testcase_20 AC 23 ms
42,884 KB
testcase_21 AC 23 ms
43,008 KB
testcase_22 AC 22 ms
43,008 KB
testcase_23 AC 23 ms
43,008 KB
testcase_24 AC 23 ms
42,924 KB
testcase_25 AC 10 ms
42,880 KB
testcase_26 AC 12 ms
43,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<ctime>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<map>
using namespace std;
typedef long long LL;
const int MR=1e5+10;
int n;
int a[101],b[101];
int dp[101][MR];
int main(){
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i]>>b[i];
    memset(dp,0x3f,sizeof dp);
    dp[0][0]=0;
    for(int i=1;i<=n;i++){
        for(int j=0;j<MR;j++){
            dp[i][j]=dp[i-1][j]+b[i];
            if(j>=a[i]){
                dp[i][j]=min(dp[i][j],dp[i-1][j-a[i]]);
            }
        }
    }
    int ans=1e9;
    for(int j=0;j<MR;j++){
        ans=min(max(j,dp[n][j]),ans);
    }
    cout<<ans<<endl;
    return 0;
}
0