結果

問題 No.710 チーム戦
ユーザー gazellegazelle
提出日時 2018-08-25 20:43:17
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 86 ms / 3,000 ms
コード長 934 bytes
コンパイル時間 2,233 ms
コンパイル使用メモリ 204,428 KB
実行使用メモリ 82,444 KB
最終ジャッジ日時 2023-09-09 03:21:30
合計ジャッジ時間 5,583 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,272 KB
testcase_01 AC 6 ms
7,804 KB
testcase_02 AC 85 ms
82,184 KB
testcase_03 AC 84 ms
82,312 KB
testcase_04 AC 84 ms
82,184 KB
testcase_05 AC 83 ms
82,360 KB
testcase_06 AC 83 ms
82,444 KB
testcase_07 AC 84 ms
82,308 KB
testcase_08 AC 84 ms
82,312 KB
testcase_09 AC 84 ms
82,312 KB
testcase_10 AC 82 ms
82,188 KB
testcase_11 AC 84 ms
82,308 KB
testcase_12 AC 82 ms
82,188 KB
testcase_13 AC 83 ms
82,256 KB
testcase_14 AC 83 ms
82,232 KB
testcase_15 AC 84 ms
82,200 KB
testcase_16 AC 84 ms
82,180 KB
testcase_17 AC 83 ms
82,364 KB
testcase_18 AC 84 ms
82,280 KB
testcase_19 AC 84 ms
82,248 KB
testcase_20 AC 84 ms
82,300 KB
testcase_21 AC 83 ms
82,444 KB
testcase_22 AC 84 ms
82,180 KB
testcase_23 AC 86 ms
82,252 KB
testcase_24 AC 82 ms
82,248 KB
testcase_25 AC 3 ms
4,576 KB
testcase_26 AC 3 ms
4,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define MOD 1000000007ll
#define INF 1000000000ll
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n;
	cin>>n;
	vector<ll> a(n);
	vector<ll> b(n);
	REP(i,n) cin>>a[i]>>b[i];
	vector<vector<ll>> dp(n,vector<ll>(100010,INF*INF));
	REP(i,n) REP(j,100010) {
		if(i) {
			dp[i][j]=min(dp[i][j],dp[i-1][j]+b[i]);
			if(j>=a[i]) dp[i][j]=min(dp[i][j],dp[i-1][j-a[i]]);
		} else {
			if(j==a[i]) dp[i][j]=0;
			if(j==0) dp[i][j]=b[i];
		}
	}
	ll ans=INF*INF;
	REP(i,100010) ans=min(ans,max(i,dp[n-1][i]));
	cout<<ans<<endl;
}

0