結果

問題 No.710 チーム戦
ユーザー CleyLCleyL
提出日時 2022-11-08 14:53:23
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 587 bytes
コンパイル時間 553 ms
コンパイル使用メモリ 69,740 KB
実行使用メモリ 43,100 KB
最終ジャッジ日時 2023-09-29 04:50:45
合計ジャッジ時間 2,488 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,912 KB
testcase_01 AC 5 ms
7,496 KB
testcase_02 WA -
testcase_03 AC 32 ms
42,840 KB
testcase_04 WA -
testcase_05 AC 33 ms
42,788 KB
testcase_06 WA -
testcase_07 AC 31 ms
42,852 KB
testcase_08 WA -
testcase_09 AC 32 ms
42,892 KB
testcase_10 AC 32 ms
42,860 KB
testcase_11 WA -
testcase_12 AC 32 ms
42,892 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 31 ms
42,840 KB
testcase_16 AC 32 ms
42,804 KB
testcase_17 WA -
testcase_18 AC 32 ms
43,100 KB
testcase_19 AC 33 ms
42,788 KB
testcase_20 AC 31 ms
42,808 KB
testcase_21 WA -
testcase_22 AC 32 ms
42,788 KB
testcase_23 AC 33 ms
42,852 KB
testcase_24 AC 32 ms
43,076 KB
testcase_25 AC 2 ms
4,408 KB
testcase_26 AC 2 ms
4,380 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(!dp[i][j] && i+j != 0)continue;
      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