結果

問題 No.2999 Long Long Friedrice
ユーザー umezo
提出日時 2024-12-24 00:06:28
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 678 bytes
コンパイル時間 4,046 ms
コンパイル使用メモリ 247,132 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 00:06:33
合計ジャッジ時間 4,069 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
template <class T> using V=vector<T>;
template <class T> using VV=V<V<T>>;

V<int> G[1000500];
int dp[1000500];
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  int n;
  cin>>n;
  V<int> A(n),B(n);
  rep(i,n) cin>>A[i];
  rep(i,n) cin>>B[i];
  rep(i,n){
    G[A[i]].push_back(A[i]+B[i]);
  }
  dp[1]=1;
  for(int i=1;i<1000500;i++){
    if(dp[i]==0) continue;
    for(auto nv:G[i]) dp[nv]=1;
  }
  for(int i=1000499;i>0;i--){
    if(dp[i]){
      cout<<i<<endl;
      return 0;
    }
  }
    
  return 0;
}
0