結果

問題 No.2922 Rose Garden
ユーザー may17
提出日時 2024-10-12 14:59:59
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 90 ms / 3,000 ms
コード長 605 bytes
コンパイル時間 1,994 ms
コンパイル使用メモリ 192,572 KB
最終ジャッジ日時 2025-02-24 17:49:55
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
//#include<atcoder/all>
using namespace std;
//using namespace atcoder;
using ll = long long;
const ll mod = 1000000007;
//const ll mod = 998244353;
int dx[4] = { 0,1,0,-1 }, dy[4] = { -1,0,1,0 };
ll n, s, b, h[200009];
int main() {
	cin >> n >> s >> b;
	for (int i = 1; i <= n; i++)cin >> h[i];
	ll now = s;
	for (int i = 1; i <= n-1; i++) {
		if (h[i + 1] <= h[i])h[i+1]=h[i];
		else {
			ll dif = h[i + 1] - h[i];
			ll need = (dif + b - 1LL) / b;
			now -= need;
			if (now < 0) {
				cout << "No" << endl;
				return 0;
			}
			else now = s;
		}
	}
	cout << "Yes" << endl;
}
0