結果

問題 No.710 チーム戦
ユーザー lapilapi
提出日時 2019-08-10 18:47:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,205 bytes
コンパイル時間 1,084 ms
コンパイル使用メモリ 106,804 KB
実行使用メモリ 42,692 KB
最終ジャッジ日時 2023-09-26 23:30:39
合計ジャッジ時間 3,407 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 30 ms
22,844 KB
testcase_03 AC 30 ms
23,240 KB
testcase_04 AC 31 ms
24,508 KB
testcase_05 AC 29 ms
22,584 KB
testcase_06 AC 30 ms
23,512 KB
testcase_07 AC 31 ms
23,776 KB
testcase_08 AC 32 ms
24,944 KB
testcase_09 AC 30 ms
23,556 KB
testcase_10 AC 28 ms
21,572 KB
testcase_11 AC 29 ms
23,436 KB
testcase_12 AC 32 ms
24,776 KB
testcase_13 AC 31 ms
24,028 KB
testcase_14 AC 30 ms
24,116 KB
testcase_15 AC 28 ms
21,964 KB
testcase_16 AC 31 ms
24,668 KB
testcase_17 AC 28 ms
21,920 KB
testcase_18 AC 30 ms
23,516 KB
testcase_19 AC 31 ms
24,592 KB
testcase_20 AC 28 ms
22,644 KB
testcase_21 AC 30 ms
23,956 KB
testcase_22 WA -
testcase_23 AC 3 ms
4,380 KB
testcase_24 AC 54 ms
41,240 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include <iomanip>
#include <cmath>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60

int A[109], B[109];
int dp[109][100009]; // dp[i][j] : j秒かけて1からi番目までのうちのいくつかを解いたときの、浮いた時間の最大値

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N; cin >> N;
	int btot = 0;
	int atot = 0;
	for (int i = 1; i <= N; i++) {
		cin >> A[i] >> B[i];
		atot += A[i];
		btot += B[i];
	}

	for (int i = 0; i < N; i++) {
		for (int j = 0; j <= atot; j++) {
			dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]); // A君がi+1番目の問題を解かない
			dp[i + 1][j + A[i + 1]] = max(dp[i + 1][j + A[i + 1]], dp[i][j] + B[i + 1]); // A君がi+1番目の問題を解いた場合
		}
	}

	int ans = INF;
	for (int i = 0; i <= atot; i++) {
		int T = max(i, btot - dp[N][i]);
		ans = min(ans, T);
	}

	cout << ans << endl;

	return 0;
}
0