結果

問題 No.710 チーム戦
ユーザー minatominato
提出日時 2020-03-17 08:07:38
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 45 ms / 3,000 ms
コード長 1,112 bytes
コンパイル時間 1,848 ms
コンパイル使用メモリ 175,796 KB
実行使用メモリ 43,476 KB
最終ジャッジ日時 2023-08-19 23:10:37
合計ジャッジ時間 4,249 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,932 KB
testcase_01 AC 5 ms
7,400 KB
testcase_02 AC 44 ms
43,200 KB
testcase_03 AC 44 ms
43,272 KB
testcase_04 AC 45 ms
43,200 KB
testcase_05 AC 43 ms
43,220 KB
testcase_06 AC 43 ms
43,216 KB
testcase_07 AC 43 ms
43,220 KB
testcase_08 AC 44 ms
43,176 KB
testcase_09 AC 44 ms
43,392 KB
testcase_10 AC 44 ms
43,248 KB
testcase_11 AC 43 ms
43,184 KB
testcase_12 AC 43 ms
43,196 KB
testcase_13 AC 43 ms
43,180 KB
testcase_14 AC 44 ms
43,220 KB
testcase_15 AC 43 ms
43,244 KB
testcase_16 AC 43 ms
43,476 KB
testcase_17 AC 43 ms
43,260 KB
testcase_18 AC 43 ms
43,432 KB
testcase_19 AC 44 ms
43,200 KB
testcase_20 AC 43 ms
43,220 KB
testcase_21 AC 43 ms
43,260 KB
testcase_22 AC 40 ms
43,264 KB
testcase_23 AC 40 ms
43,280 KB
testcase_24 AC 41 ms
43,392 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 3 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
#define ln '\n'
const long long MOD = 1000000007LL;
//const long long MOD = 998244353LL;
typedef long long ll;
typedef unsigned long long ull; 
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true;} return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true;} return false; }
///////////////////////////////////////////////////////////////////////////////////////////////////

int dp[101][101010];
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
	int N; cin >> N;
	vector<int> A(N),B(N);
	rep(i,N) cin >> A[i] >> B[i];

	rep(i,N+1) rep(j,101010) dp[i][j] = 1e9;
	dp[0][0] = 0;
	rep(i,N) {
		rep(j,100001) {
			chmin(dp[i+1][j],dp[i][j]+B[i]);
			if (j < A[i]) continue;
			chmin(dp[i+1][j],dp[i][j-A[i]]);
		}
	}
	int ans = 1e9;
	rep(j,100001) {
		chmin(ans,max(j,dp[N][j]));
	}

	cout << ans << ln;
}
0