結果
問題 | No.710 チーム戦 |
ユーザー |
![]() |
提出日時 | 2018-08-25 20:43:17 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 171 ms / 3,000 ms |
コード長 | 934 bytes |
コンパイル時間 | 2,194 ms |
コンパイル使用メモリ | 198,476 KB |
最終ジャッジ日時 | 2025-01-06 12:37:57 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 25 |
ソースコード
#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_backint 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;}