結果
問題 | No.710 チーム戦 |
ユーザー |
|
提出日時 | 2020-07-11 23:29:00 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 65 ms / 3,000 ms |
コード長 | 452 bytes |
コンパイル時間 | 1,861 ms |
コンパイル使用メモリ | 197,984 KB |
最終ジャッジ日時 | 2025-01-11 19:51:15 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 25 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:10:21: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | int n; scanf("%d",&n); | ~~~~~^~~~~~~~~ main.cpp:15:31: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | int a,b; scanf("%d%d",&a,&b); | ~~~~~^~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; const int INF=1<<29; int main(){ int n; scanf("%d",&n); vector dp(n+1,vector(100001,INF)); dp[0][0]=0; rep(i,n){ int a,b; scanf("%d%d",&a,&b); rep(j,100001-a) dp[i+1][j+a]=min(dp[i+1][j+a],dp[i][j]); rep(j,100001) dp[i+1][j]=min(dp[i+1][j],dp[i][j]+b); } int ans=INF; rep(j,100001) ans=min(ans,max(j,dp[n][j])); printf("%d\n",ans); return 0; }