結果

問題 No.710 チーム戦
ユーザー CleyLCleyL
提出日時 2022-11-08 15:00:32
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 34 ms / 3,000 ms
コード長 546 bytes
コンパイル時間 563 ms
コンパイル使用メモリ 68,508 KB
実行使用メモリ 43,108 KB
最終ジャッジ日時 2023-09-29 04:57:23
合計ジャッジ時間 2,604 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,104 KB
testcase_01 AC 5 ms
7,432 KB
testcase_02 AC 34 ms
42,868 KB
testcase_03 AC 33 ms
42,924 KB
testcase_04 AC 33 ms
42,860 KB
testcase_05 AC 33 ms
42,996 KB
testcase_06 AC 33 ms
42,852 KB
testcase_07 AC 32 ms
42,808 KB
testcase_08 AC 33 ms
42,864 KB
testcase_09 AC 32 ms
42,820 KB
testcase_10 AC 33 ms
42,924 KB
testcase_11 AC 33 ms
42,784 KB
testcase_12 AC 33 ms
42,992 KB
testcase_13 AC 32 ms
42,992 KB
testcase_14 AC 32 ms
42,872 KB
testcase_15 AC 32 ms
42,992 KB
testcase_16 AC 32 ms
42,852 KB
testcase_17 AC 33 ms
42,940 KB
testcase_18 AC 32 ms
42,880 KB
testcase_19 AC 33 ms
42,804 KB
testcase_20 AC 33 ms
42,800 KB
testcase_21 AC 33 ms
42,860 KB
testcase_22 AC 33 ms
42,992 KB
testcase_23 AC 33 ms
43,108 KB
testcase_24 AC 33 ms
42,860 KB
testcase_25 AC 3 ms
4,380 KB
testcase_26 AC 3 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int dp[101][100001];

int main(){
  int n;cin>>n;
  for(int i = 0; n >= i; i++){
    for(int j = 0; 100000 >= j; j++){
      dp[i][j] = 100001;
    }
  }
  dp[0][0] = 0;
  for(int i = 0; n > i; i++){
    int a,b;cin>>a>>b;
    for(int j = 0; 100000 > j; j++){
      if(j+a <= 100000)dp[i+1][j+a] = min(dp[i+1][j+a],dp[i][j]);
      dp[i+1][j] = min(dp[i+1][j],dp[i][j]+b);
    }
  }
  int ans = 100000;
  for(int i = 0; 100000 >= i; i++){
    ans = min(ans,max(i,dp[n][i]));
  }
  cout << ans << endl;
}
0