結果

問題 No.710 チーム戦
ユーザー どららどらら
提出日時 2018-06-30 00:24:28
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 31 ms / 3,000 ms
コード長 892 bytes
コンパイル時間 1,568 ms
コンパイル使用メモリ 169,312 KB
実行使用メモリ 44,556 KB
最終ジャッジ日時 2023-09-13 15:56:18
合計ジャッジ時間 3,501 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
44,460 KB
testcase_01 AC 16 ms
44,388 KB
testcase_02 AC 29 ms
44,336 KB
testcase_03 AC 30 ms
44,492 KB
testcase_04 AC 29 ms
44,556 KB
testcase_05 AC 30 ms
44,332 KB
testcase_06 AC 28 ms
44,328 KB
testcase_07 AC 29 ms
44,400 KB
testcase_08 AC 29 ms
44,484 KB
testcase_09 AC 29 ms
44,324 KB
testcase_10 AC 28 ms
44,336 KB
testcase_11 AC 29 ms
44,488 KB
testcase_12 AC 29 ms
44,552 KB
testcase_13 AC 28 ms
44,324 KB
testcase_14 AC 29 ms
44,324 KB
testcase_15 AC 28 ms
44,516 KB
testcase_16 AC 29 ms
44,360 KB
testcase_17 AC 28 ms
44,328 KB
testcase_18 AC 30 ms
44,336 KB
testcase_19 AC 30 ms
44,372 KB
testcase_20 AC 30 ms
44,316 KB
testcase_21 AC 30 ms
44,328 KB
testcase_22 AC 27 ms
44,324 KB
testcase_23 AC 26 ms
44,396 KB
testcase_24 AC 31 ms
44,488 KB
testcase_25 AC 15 ms
44,324 KB
testcase_26 AC 15 ms
44,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

const static int INF = (int)1e9;

int dp[105][100005];


int main(){
  int N;
  cin >> N;
  vector<vector<int>> adj(2, vector<int>(N));
  rep(i,N){
    cin >> adj[0][i] >> adj[1][i];
  }

  rep(i,105){
    rep(j,100005){
      dp[i][j] = INF;
    }
  }
  dp[0][0] = 0;

  rep(i,N){
    rep(j,100005){
      if(dp[i][j] == INF) continue;

      dp[i+1][j+adj[0][i]] = min(dp[i+1][j+adj[0][i]], dp[i][j]);
      dp[i+1][j] = min(dp[i+1][j], dp[i][j] + adj[1][i]);
    }
  }

  int ret = INF;
  rep(i,100005){
    ret = min(ret, max(i, dp[N][i]));
  }

  cout << ret << endl;
  
  return 0;
}

0