結果

問題 No.2922 Rose Garden
ユーザー jastaway【競プロ】@青復帰!!!jastaway【競プロ】@青復帰!!!
提出日時 2024-10-12 16:49:11
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 28 ms / 3,000 ms
コード長 7,040 bytes
コンパイル時間 5,653 ms
コンパイル使用メモリ 310,108 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-12 16:49:20
合計ジャッジ時間 8,185 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
6,824 KB
testcase_01 AC 10 ms
6,820 KB
testcase_02 AC 15 ms
6,816 KB
testcase_03 AC 24 ms
6,816 KB
testcase_04 AC 15 ms
6,816 KB
testcase_05 AC 15 ms
6,820 KB
testcase_06 AC 10 ms
6,816 KB
testcase_07 AC 20 ms
6,820 KB
testcase_08 AC 7 ms
6,820 KB
testcase_09 AC 25 ms
6,816 KB
testcase_10 AC 8 ms
6,820 KB
testcase_11 AC 6 ms
6,816 KB
testcase_12 AC 15 ms
6,820 KB
testcase_13 AC 22 ms
6,816 KB
testcase_14 AC 5 ms
6,820 KB
testcase_15 AC 16 ms
6,816 KB
testcase_16 AC 18 ms
6,816 KB
testcase_17 AC 26 ms
6,816 KB
testcase_18 AC 3 ms
6,820 KB
testcase_19 AC 13 ms
6,820 KB
testcase_20 AC 17 ms
6,816 KB
testcase_21 AC 24 ms
6,816 KB
testcase_22 AC 14 ms
6,820 KB
testcase_23 AC 21 ms
6,816 KB
testcase_24 AC 5 ms
6,816 KB
testcase_25 AC 13 ms
6,820 KB
testcase_26 AC 19 ms
6,820 KB
testcase_27 AC 21 ms
6,816 KB
testcase_28 AC 18 ms
6,820 KB
testcase_29 AC 16 ms
6,820 KB
testcase_30 AC 3 ms
6,820 KB
testcase_31 AC 3 ms
6,820 KB
testcase_32 AC 2 ms
6,820 KB
testcase_33 AC 2 ms
6,816 KB
testcase_34 AC 3 ms
6,816 KB
testcase_35 AC 2 ms
6,816 KB
testcase_36 AC 4 ms
6,816 KB
testcase_37 AC 5 ms
6,820 KB
testcase_38 AC 3 ms
6,816 KB
testcase_39 AC 4 ms
6,816 KB
testcase_40 AC 16 ms
6,820 KB
testcase_41 AC 10 ms
6,820 KB
testcase_42 AC 25 ms
6,820 KB
testcase_43 AC 12 ms
6,816 KB
testcase_44 AC 25 ms
6,820 KB
testcase_45 AC 6 ms
6,816 KB
testcase_46 AC 28 ms
6,820 KB
testcase_47 AC 19 ms
6,820 KB
testcase_48 AC 6 ms
6,816 KB
testcase_49 AC 23 ms
6,816 KB
testcase_50 AC 2 ms
6,816 KB
testcase_51 AC 4 ms
6,820 KB
testcase_52 AC 2 ms
6,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
// #include <boost/rational.hpp>
// using namespace boost;
// using rat = rational<long long int>;
#define ll long long
#define ld long double
#define ull uint64_t
#define pll pair<ll,ll>
#define vll vector<ll>
#define vvll vector<vll>
#define vvvll vector<vvll>
#define vpll vector<pll>
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
#define vvv(T) vector<vector<vector<T>>>
using mint = modint998244353;
template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>;
#define maxseg(T) segtree<T, [](T x, T y){return max(x, y);}, [](){return (T)(-(1LL << 60));}>
#define minseg(T) segtree<T, [](T x, T y){return min(x, y);}, [](){return (T)((1LL << 60));}>
#define sumseg(T) segtree<T, [](T x, T y){return x + y;}, [](){return (T)(0);}>
// template<class T> using maxseg = segtree<T, [](T x, T y){return max(x, y);}, [](){return (T)(-(1 << 30));}>;
// template<class T> using minseg = segtree<T, [](T x, T y){return min(x, y);}, [](){return (T)((1 << 30));}>;
// template<class T> using sumseg = segtree<T, [](T x, T y){return x + y;}, [](){return (T)(0);}>;
// template<class T> struct v : vector<T> { using vector<T> :: vector; };
// template<class T> struct vv : vector<v<T>> { using vector<v<T>> :: vector; };
// template<class T> struct vvv : vector<vv<T>> { using vector<vv<T>> :: vector; };
template<class T> inline bool chmin(T& a, T b) {if(a > b){a = b; return true;} else {return false;}};
template<class T> inline bool chmax(T& a, T b) {if(a < b){a = b; return true;} else {return false;}};
#define rep(i,n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i,n) for(ll i = (ll)(n) - 1; i >= 0; i--)
#define REP(i, l, r) for(ll i = (ll)l; i <= (ll)(r); i++)
#define REPR(i, l, r) for(ll i = (ll)r; i >= (ll)(l); i--)
const ll inf = (1 << 30);
const ll INF = ((ll)1 << 60);
const vector<pair<ll, ll>> DIJ = {{1, 0}, {0, -1}, {-1, 0}, {0, 1}};
template<class T> void out(T a){cout << a << endl;}
void out1(mint a){cout << a.val();}
template<class T> void out1(T a){cout << a;}
template<class T, class U> void out2(T a, U b){cout << a << " " << b << endl;}
template<class T, class U, class V> void out3(T a, U b, V c) {cout << a << " " << b << " " << c << endl;}
template<class T, class U> void outp(pair<T, U> a){ out1(a.first); out1(" "); out1(a.second); cout << endl; }
template<class T> void outv(T a){rep(i, a.size()){ cout << a.at(i) << " "; } cout << endl;}
template<class T> void outvmint(T a) {rep(i, a.size()) { cout << a.at(i).val() << " "; } cout << endl;}
template<class T> void outvL(T a){rep(i, a.size()){out(a.at(i));}}
template<class T> void outvLmint(T a) {rep(i, a.size()){out(a.at(i).val());}}
template<class T> void outvv(T a){rep(i, a.size()){ rep(j, a.at(i).size()){cout << a.at(i).at(j) << " "; } cout << endl; }}
template<class T> void outvp(T a){rep(i, a.size()){ out2(a.at(i).first, a.at(i).second); }}
void setpre(int a){cout << fixed << setprecision(a);}
#define outN out("No")
#define outY out("Yes")
#define outL cout << endl
#define dame(a) {out(a);return 0;}
#define All(a) (a).begin(), (a).end()
template<class T> inline void sortr(T& v){sort(All(v)); reverse(All(v));}
template<class T> inline vector<int> argsort(T V, bool rev = false){vector<int> res(V.size()); iota(res.begin(), res.end(), 0); sort(res.begin(), res.end(), [&](int x, int y){if(!rev){return V.at(x) < V.at(y);}else{return V.at(x) > V.at(y);}}); return res;}
template<class T> inline void sort_by_idx(T& V, vector<int>& I){assert(V.size() == I.size()); T tmpv = V; for(int loopi = 0; loopi < (int)I.size(); loopi++){V.at(loopi) = tmpv.at(I.at(loopi));}}
template<class T, class U> inline void sortp(vector<T>& v1, vector<U>& v2, bool rev1 = false, int rev2 = false){assert(v1.size() == v2.size()); vector<int> I(v1.size()); iota(I.begin(), I.end(), 0); sort(I.begin(), I.end(), [&](const int x, const int y){if(v1.at(x) != v1.at(y)){return (bool)(rev1 ^ (v1.at(x) < v1.at(y)));}else{if(v2.at(x)==v2.at(y)){return false;} return (bool)(rev2 ^ (v2.at(x) < v2.at(y)));}}); sort_by_idx(v1, I); sort_by_idx(v2, I);}
template<class T> T POW(T x, ll n) {T ret = 1; while(n > 0){if(n & 1) ret *= x; x *= x; n >>= 1;} return ret;}
ll powll(ll x, ll n){ll ret = 1; while(n > 0){if(n & 1) ret *= x; x *= x; n >>= 1;} return ret;}
#define cin1(n) cin >> (n)
#define cin2(n, m) cin >> (n) >> (m)
#define cin3(n, m, k) cin >> (n) >> (m) >> (k)
#define cin4(n, m, k, l) cin >> (n) >> (m) >> (k) >> (l)
#define cinv(a) rep(lopi, a.size()) cin >> (a).at(lopi)
#define cinll1(n) ll n; cin >> (n)
#define cinll2(n, m) ll n, m; cin >> (n) >> (m)
#define cinll3(n, m, k) ll n, m, k; cin >> (n) >> (m) >> (k)
#define cinll4(n, m, k, l) ll n, m, k, l; cin >> (n) >> (m) >> (k) >> (l)
#define cinvll(a, n) vll a(n); rep(lopi, (n)) cin >> (a).at(lopi)
#define cinstr(S) string S; cin >> (S)
#define cinvt(type, a, n) v(type) a(n); rep(lopi, n) cin >> (a).at(lopi)
#define makeundirGll(G, N, M) G = vvll(N); rep(lopi, M) {ll a, b; cin >> a >> b; G.at(a-1).push_back(b-1); G.at(b-1).push_back(a-1);}
#define makedirGll(G, N, M) G = vvll(N); rep(lopi, M) {ll a, b; cin >> a >> b; G.at(a-1).push_back(b-1);}
#define makeundirwghGll(G, N, M) G = vv(pll)(N); rep(lopi, M) {ll a, b, c; cin >> a >> b >> c; G.at(a-1).push_back({b-1,c}); G.at(b-1).push_back({a-1, c});}
#define makedirwghGll (G, N, M) G = vv(pll)(N); rep(lopi, M) {ll a, b, c; cin >> a >> b >> c; G.at(a-1).push_back({b-1, c});}
ll llceil(ll x, ll y) { if(x >= 0) {return(x / y + (ll)(x % y != 0)); } else { return -((-x) / y); } }
inline bool inLR(ll x, ll L, ll R){ return (L <= x && x < R); }
inline bool is_in_Rect(ll pos_x, ll pos_y, ll rect_H, ll rect_W, ll rect_h = 0, ll rect_w = 0){ return (rect_h <= pos_x && pos_x < rect_H && rect_w <= pos_y && pos_y < rect_W); }

template<class T> vector<T> &operator++(vector<T> &v) {for(auto &e : v){e++;} return v;}
template<class T> vector<T> operator++(vector<T> &v, signed) {auto res=v; for(auto &e : v){e++;} return res;}
template<class T> vector<T> &operator--(vector<T> &v) {for(auto &e : v){e--;} return v;}
template<class T> vector<T> operator--(vector<T> &v, signed) {auto res=v; for(auto &e : v){e--;} return res;}
template<class T, class U> pair<T, U> operator+(pair<T, U> &x, pair<T, U> &y) { return make_pair(x.first + y.first, x.second + y.second); }
template<class T, class U> void operator+=(pair<T, U> &x, pair<T, U> &y) { x = x + y; }

int main()
{
    std::cin.tie(nullptr), std::ios_base::sync_with_stdio(false);
    cinll3(N, S, B);
    cinvll(H, N);
    ll now = H.at(0), ns = S;
    rep(i, N - 1)
    {
        ll dif = now - H.at(i);
        ll ls = S - ns;
        if(dif < ls * B)
        {
            now = H.at(i);
            ns = S;
        }
        if(now >= H.at(i + 1)) continue;
        else
        {
            ll need = H.at(i + 1) - now;
            ll needs = llceil(need, B);
            if(needs > ns) dame("No");
            ns -= needs;
            now += needs * B;
        }
    }
    outY;
}
0