結果
| 問題 |
No.2922 Rose Garden
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-10-12 16:04:34 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 923 bytes |
| コンパイル時間 | 1,013 ms |
| コンパイル使用メモリ | 102,680 KB |
| 実行使用メモリ | 814,668 KB |
| 最終ジャッジ日時 | 2024-10-12 16:04:58 |
| 合計ジャッジ時間 | 4,053 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | MLE * 1 -- * 49 |
ソースコード
#include<iostream>
#include<string>
#include<algorithm>
#include<unordered_set>
#include<stdio.h>
using namespace std;
int main()
{
long N,S,B;
cin>>N>>S>>B;
long H[N];
for(int i=0;i<N;i++){
cin>>H[i];
}
long dp[N+1][S+1];
fill(dp[0],dp[N+1],-1);
dp[0][S]=H[0];
for(int i=0;i<N;i++){
long m=0;
for(int j=S;j>-1;j--){
if (dp[i][j]==-1){continue;}
m=max(m,dp[i][j]);
if (j>0){
dp[i][j-1]=dp[i][j]+B;
}
if(i!=N-1){
if(dp[i][j]>=H[i+1]){
dp[i+1][j]=dp[i][j];
}
}
}
if(m>=H[i]){dp[i][S]=max(H[i],dp[i][S]);}
}
bool f=false;
for(int j=0;j<S+1;j++){
if(dp[N-1][j]!=-1){f=true;}
}
if (f){
cout<<"Yes"<<endl;
}
else{
cout<<"No"<<endl;
}
}