結果
問題 | No.2999 Long Long Friedrice |
ユーザー |
👑 ![]() |
提出日時 | 2024-12-24 00:45:43 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 7 ms / 2,000 ms |
コード長 | 842 bytes |
コンパイル時間 | 1,047 ms |
コンパイル使用メモリ | 83,008 KB |
最終ジャッジ日時 | 2025-02-26 16:19:55 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 33 |
ソースコード
#ifdef NACHIA#define _GLIBCXX_DEBUG#else#define NDEBUG#endif#include <iostream>#include <string>#include <vector>#include <algorithm>using i64 = long long;using u64 = unsigned long long;#define rep(i,n) for(int i=0; i<int(n); i++)const i64 INF = 1001001001001001001;template<typename A> void chmin(A& l, const A& r){ if(r < l) l = r; }template<typename A> void chmax(A& l, const A& r){ if(l < r) l = r; }using namespace std;void testcase(){int N; cin >> N;vector<pair<i64,i64>> A(N);rep(i,N) cin >> A[i].first;rep(i,N) cin >> A[i].second;sort(A.rbegin(), A.rend());vector<i64> dp(1000100);rep(i,dp.size()) dp[i] = i;for(auto [a,b] : A) chmax(dp[a], dp[a+b]);cout << dp[1] << "\n";}int main(){ios::sync_with_stdio(false); cin.tie(nullptr);testcase();return 0;}