結果

問題 No.2922 Rose Garden
コンテスト
ユーザー Ayuna
提出日時 2024-10-19 16:55:21
言語 C++17
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 52 ms / 3,000 ms
コード長 495 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 366 ms
コンパイル使用メモリ 96,156 KB
実行使用メモリ 9,228 KB
最終ジャッジ日時 2026-07-06 00:40:41
合計ジャッジ時間 3,851 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <vector>
#include <map>

using namespace std;
using ll = long long;


int main(){
  int n, s;
  ll b;
  cin >> n >> s >> b;
  vector<ll> h(n);
  for (ll &i: h) cin >> i;
  ll now = h[0];
  ll st = s;
  for (int i = 0; i < n - 1; i++){
    if (now >= h[i + 1]) continue;
    ll diff = h[i + 1] - now;
    ll need = (diff + b - 1) / b;
    if (need > st){
      cout << "No" << endl;
      return 0;
    }
    st = s;
    now = h[i + 1];
  }
  cout << "Yes" << endl;
}
0