結果

問題 No.2922 Rose Garden
ユーザー umezo
提出日時 2024-10-12 14:45:52
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 136 ms / 3,000 ms
コード長 593 bytes
コンパイル時間 2,670 ms
コンパイル使用メモリ 247,444 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-10-12 14:46:02
合計ジャッジ時間 5,417 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

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>>;

int dp[200200];
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  ll n,s,b;
  cin>>n>>s>>b;
  V<ll> H(n);
  rep(i,n) cin>>H[i];
  
  dp[0]=1;
  rep(i,n-1){
    if(dp[i]==0) continue;
    for(int j=1;j<n && i+j<n;j++){
      if(H[i+j]>H[i]+s*b) break;
      dp[i+j]=1;
    }
  }
  if(dp[n-1]) cout<<"Yes\n";
  else cout<<"No\n";
    
  return 0;
}
0