結果

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

ソースコード

diff #

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

template<class T> istream& operator >> (istream& is, vector<T>& vec) {
    for(T& x : vec) is >> x;
    return is;
}

template<class T> ostream& operator << (ostream& os, const vector<T>& vec) {
    if(vec.empty()) return os;
    os << vec[0];
    for(auto it = vec.begin(); ++it != vec.end(); ) os << ' ' << *it;
    return os;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, s, b;
    cin >> n >> s >> b;
    vector<ll> a(n);
    cin >> a;
    ll pre = a[0];
    for(int i = 1; i < n; i++){
        if(a[i] > pre && a[i] <= pre + s * b){
            pre = a[i];
        }else if(a[i] > pre){
            cout << "No\n";
            return 0;
        }
    }
    cout << (a.back() <= pre ? "Yes" : "No") << '\n';
}
0