結果
問題 | No.710 チーム戦 |
ユーザー |
![]() |
提出日時 | 2018-06-30 00:24:28 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 31 ms / 3,000 ms |
コード長 | 892 bytes |
コンパイル時間 | 1,855 ms |
コンパイル使用メモリ | 172,212 KB |
実行使用メモリ | 44,652 KB |
最終ジャッジ日時 | 2024-07-01 00:36:11 |
合計ジャッジ時間 | 3,612 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 25 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)#define rep(i,n) REP(i,0,n)#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)#define ALLOF(c) (c).begin(), (c).end()typedef long long ll;typedef unsigned long long ull;const static int INF = (int)1e9;int dp[105][100005];int main(){int N;cin >> N;vector<vector<int>> adj(2, vector<int>(N));rep(i,N){cin >> adj[0][i] >> adj[1][i];}rep(i,105){rep(j,100005){dp[i][j] = INF;}}dp[0][0] = 0;rep(i,N){rep(j,100005){if(dp[i][j] == INF) continue;dp[i+1][j+adj[0][i]] = min(dp[i+1][j+adj[0][i]], dp[i][j]);dp[i+1][j] = min(dp[i+1][j], dp[i][j] + adj[1][i]);}}int ret = INF;rep(i,100005){ret = min(ret, max(i, dp[N][i]));}cout << ret << endl;return 0;}