結果

問題 No.710 チーム戦
ユーザー kakira9618kakira9618
提出日時 2018-06-29 23:37:49
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 57 ms / 3,000 ms
コード長 1,348 bytes
コンパイル時間 1,917 ms
コンパイル使用メモリ 86,968 KB
実行使用メモリ 43,140 KB
最終ジャッジ日時 2023-09-13 15:46:05
合計ジャッジ時間 3,090 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
5,000 KB
testcase_01 AC 5 ms
5,664 KB
testcase_02 AC 56 ms
42,868 KB
testcase_03 AC 56 ms
42,816 KB
testcase_04 AC 56 ms
42,828 KB
testcase_05 AC 56 ms
42,872 KB
testcase_06 AC 56 ms
43,140 KB
testcase_07 AC 55 ms
42,940 KB
testcase_08 AC 56 ms
42,820 KB
testcase_09 AC 56 ms
42,924 KB
testcase_10 AC 56 ms
42,820 KB
testcase_11 AC 55 ms
42,820 KB
testcase_12 AC 56 ms
43,056 KB
testcase_13 AC 55 ms
42,856 KB
testcase_14 AC 55 ms
42,936 KB
testcase_15 AC 56 ms
42,920 KB
testcase_16 AC 55 ms
42,988 KB
testcase_17 AC 55 ms
42,828 KB
testcase_18 AC 56 ms
42,816 KB
testcase_19 AC 56 ms
42,820 KB
testcase_20 AC 55 ms
42,876 KB
testcase_21 AC 55 ms
42,820 KB
testcase_22 AC 56 ms
43,140 KB
testcase_23 AC 57 ms
42,824 KB
testcase_24 AC 55 ms
42,876 KB
testcase_25 AC 3 ms
4,376 KB
testcase_26 AC 3 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<30;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main() {
  int N;
  cin >> N;
  vector<vector<int>> dp(N + 1, vector<int>(100001, INF));
  dp[0][0] = 0;
  for (int i = 0; i < N; i++) {
    int a, b;
    cin >> a >> b;
    for (int j = 0; j < 100001; j++) {
      if (j + a < 100001) 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 mi = INF;
  for (int j = 0; j < 100001; j++) {
    if (dp[N][j] != INF) {
      mi = min(mi, max(dp[N][j], j));
    }
  }
  cout << mi << endl;

  return 0;
}
0