結果
問題 | No.710 チーム戦 |
ユーザー |
![]() |
提出日時 | 2018-06-30 00:13:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 18 ms / 3,000 ms |
コード長 | 708 bytes |
コンパイル時間 | 682 ms |
コンパイル使用メモリ | 74,476 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-01 00:33:54 |
合計ジャッジ時間 | 1,949 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 25 |
ソースコード
#include <iostream>#include <vector>#include <string>#include <algorithm>#include <cstdio>#include <cstring>#include <cmath>using namespace std;using ll = long long;int dp[100001], dp2[100001];int main() {int n;cin >> n;for (int i = 0; i < n; i++) {int a, b;cin >> a >> b;for (int j = 0; j < 100001; j++) {int t = dp[j] + b;if (j - a >= 0) t = min(t, dp[j - a]);dp2[j] = t;}for (int j = 0; j < 100001; j++) {dp[j] = dp2[j];}}int r = 1 << 30;for (int j = 0; j < 100001; j++) {r = min(r, max(j, dp[j]));}cout << r << endl;return 0;}