結果
問題 | No.710 チーム戦 |
ユーザー |
|
提出日時 | 2023-04-13 14:57:54 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 33 ms / 3,000 ms |
コード長 | 738 bytes |
コンパイル時間 | 1,261 ms |
コンパイル使用メモリ | 82,504 KB |
実行使用メモリ | 42,992 KB |
最終ジャッジ日時 | 2024-10-09 12:47:42 |
合計ジャッジ時間 | 2,993 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 25 |
ソースコード
#include<cstdio>#include<cstring>#include<iostream>#include<cmath>#include<ctime>#include<string>#include<algorithm>#include<vector>#include<queue>#include<stack>#include<map>using namespace std;typedef long long LL;const int MR=1e5+10;int n;int a[101],b[101];int dp[101][MR];int main(){cin>>n;for(int i=1;i<=n;i++) cin>>a[i]>>b[i];memset(dp,0x3f,sizeof dp);dp[0][0]=0;for(int i=1;i<=n;i++){for(int j=0;j<MR;j++){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]]);}}}int ans=1e9;for(int j=0;j<MR;j++){ans=min(max(j,dp[n][j]),ans);}cout<<ans<<endl;return 0;}