結果

問題 No.2922 Rose Garden
ユーザー yuusaanyuusaan
提出日時 2024-10-12 14:39:49
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 24 ms / 3,000 ms
コード長 5,975 bytes
コンパイル時間 5,263 ms
コンパイル使用メモリ 323,192 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-12 14:40:02
合計ジャッジ時間 7,377 ms
ジャッジサーバーID
(参考情報)
judge / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
6,816 KB
testcase_01 AC 4 ms
6,816 KB
testcase_02 AC 10 ms
6,820 KB
testcase_03 AC 12 ms
6,820 KB
testcase_04 AC 9 ms
6,820 KB
testcase_05 AC 11 ms
6,820 KB
testcase_06 AC 7 ms
6,816 KB
testcase_07 AC 16 ms
6,820 KB
testcase_08 AC 6 ms
6,820 KB
testcase_09 AC 7 ms
6,816 KB
testcase_10 AC 2 ms
6,820 KB
testcase_11 AC 5 ms
6,816 KB
testcase_12 AC 4 ms
6,816 KB
testcase_13 AC 14 ms
6,816 KB
testcase_14 AC 5 ms
6,816 KB
testcase_15 AC 18 ms
6,816 KB
testcase_16 AC 15 ms
6,816 KB
testcase_17 AC 24 ms
6,816 KB
testcase_18 AC 3 ms
6,816 KB
testcase_19 AC 12 ms
6,816 KB
testcase_20 AC 14 ms
6,820 KB
testcase_21 AC 22 ms
6,820 KB
testcase_22 AC 13 ms
6,820 KB
testcase_23 AC 19 ms
6,820 KB
testcase_24 AC 5 ms
6,820 KB
testcase_25 AC 12 ms
6,820 KB
testcase_26 AC 19 ms
6,816 KB
testcase_27 AC 21 ms
6,816 KB
testcase_28 AC 17 ms
6,816 KB
testcase_29 AC 17 ms
6,820 KB
testcase_30 AC 3 ms
6,820 KB
testcase_31 AC 2 ms
6,816 KB
testcase_32 AC 2 ms
6,816 KB
testcase_33 AC 2 ms
6,816 KB
testcase_34 AC 3 ms
6,816 KB
testcase_35 AC 2 ms
6,820 KB
testcase_36 AC 3 ms
6,816 KB
testcase_37 AC 4 ms
6,820 KB
testcase_38 AC 3 ms
6,816 KB
testcase_39 AC 3 ms
6,816 KB
testcase_40 AC 14 ms
6,816 KB
testcase_41 AC 8 ms
6,816 KB
testcase_42 AC 24 ms
6,820 KB
testcase_43 AC 11 ms
6,816 KB
testcase_44 AC 22 ms
6,816 KB
testcase_45 AC 6 ms
6,816 KB
testcase_46 AC 23 ms
6,820 KB
testcase_47 AC 16 ms
6,824 KB
testcase_48 AC 5 ms
6,816 KB
testcase_49 AC 19 ms
6,820 KB
testcase_50 AC 2 ms
6,816 KB
testcase_51 AC 2 ms
6,816 KB
testcase_52 AC 2 ms
6,816 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'S op(S, S)':
main.cpp:154:1: warning: no return statement in function returning non-void [-Wreturn-type]
  154 | }//何を求めるか(最大値とか)
      | ^

ソースコード

diff #

#include <iostream>
#include <string>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <tuple>
#include <map>
#include<set>
#include<queue>
#include<stack>
#include <unordered_set>
#include<thread>
#include<bits/stdc++.h>
#include <numbers>

#include <atcoder/all>
#include <cstdio>

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

//if(a < 0 || h <= a || b < 0 || w <= b)return;


using namespace std;
using namespace atcoder;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using mint = modint998244353;
using mint1 = modint1000000007;
//using VL = vector<ll>;
template<typename T> using pq = priority_queue<T>;//降順?(最大取り出し)
template<typename T> using pqg = priority_queue<T, vector<T>, greater<T>>;//昇順?(最小取り出し)
template<typename T> using vector2 = vector<vector<T>>;
template<typename T> using vector3 = vector<vector<vector<T>>>;
template<typename T> using vector4 = vector<vector<vector<vector<T>>>>;
template<typename T> using vector5 = vector<vector<vector<vector<vector<T>>>>>;
template<typename T> using vector6 = vector<vector<vector<vector<vector<vector<T>>>>>>;
template<typename T> using pairs = pair<T,T>;
#define rep(i, n) for (ll i = 0; i < ll(n); i++)
#define rep1(i,n) for(int i = 1;i <= int(n);i++)
#define repm(i, m, n) for (int i = (m); (i) < int(n);(i)++)
#define repmr(i, m, n) for (int i = (m) - 1; (i) >= int(n);(i)--)
#define rep0(i,n) for(int i = n - 1;i >= 0;i--)
#define rep01(i,n) for(int i = n;i >= 1;i--)



// NのK乗根N < 2^64, K <= 64
uint64_t kth_root(uint64_t N, uint64_t K) {
    assert(K >= 1);
    if (N <= 1 || K == 1) return N;
    if (K >= 64) return 1;
    if (N == uint64_t(-1)) --N;
    
    auto mul = [&](uint64_t x, uint64_t y) -> uint64_t {
        if (x < UINT_MAX && y < UINT_MAX) return x * y;
        if (x == uint64_t(-1) || y == uint64_t(-1)) return uint64_t(-1);
        return (x <= uint64_t(-1) / y ? x * y : uint64_t(-1));
    };
    auto power = [&](uint64_t x, uint64_t k) -> uint64_t {
        if (k == 0) return 1ULL;
        uint64_t res = 1ULL;
        while (k) {
            if (k & 1) res = mul(res, x);
            x = mul(x, x);
            k >>= 1;
        }
        return res;
    };
    
    uint64_t res;
    if (K == 2) res = sqrtl(N) - 1;
    else if (K == 3) res = cbrt(N) - 1;
    else res = pow(N, nextafter(1 / double(K), 0));
    while (power(res + 1, K) <= N) ++res;
    return res;
}
// ユークリッドの互除法による最大公約数算出
ll GCD(ll a,ll b){
    if(b == 0)return a;
    return GCD(b, a % b);
}
//拡張ユークリッドの互除法による(ax + by = GCD(a,b))を満たすx,yの算出
pair<long long, long long> extgcd(long long a, long long b) {
  if (b == 0) return make_pair(1, 0);
  long long x, y;
  tie(y, x) = extgcd(b, a % b);
  y -= a / b * x;
  return make_pair(x, y);
}
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2
    
    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }
    
    int root(int x) { // データxが属する木の根を再帰で得る:root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }
    
    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時:xの根rxをyの根ryにつける
    }
    
    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};
ll n;

//座標圧縮
vector<ll> Ccomp(vector<ll> a){
    vector<ll> b = a;
    sort(b.begin(),b.end());
    b.erase(unique(b.begin(),b.end()),b.end());//ダブり消去
    vector<ll> rtn;
    rep(j,a.size()){
        ll pb = lower_bound(b.begin(),b.end(),a[j]) - b.begin();
        rtn.push_back(pb);
    }
    return rtn;
}
/// ここから////////////////////////////////////////////




using F = bool;
using S = tuple<ll,ll,ll>;
string s;

ll modPow(ll a, ll n, ll mod) { if(mod==1) return 0;ll ret = 1; ll p = a % mod; while (n) { if (n & 1) ret = ret * p % mod; p = p * p % mod; n >>= 1; } return ret; }
void cincout(){
  ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
  cout<< fixed << setprecision(15);
}
//seg,遅延segの設定-----ここから
S op(S a,S b){
    ll al,am,ar,bl,bm,br;
    tie(al,am,ar) = a;
    tie(bl,bm,br) = b;
    
}//何を求めるか(最大値とか)

S e(){return {0,0,0};}//めんどいやつ

//S mapping (F a,S b){return a + b;}//遅延処理

F composition (F a,F b){return a + b;}//遅延中の枝にさらに処理

F id(){return 0;}//遅延のモノイド

vector<int> Op(vector<int> a,vector<int> b){a.insert(a.end(),b.begin(),b.end()); return a;}

vector<int> E(){return vector<int> (0);}

//segここまで
string abc = "abcdefghijklmnopqrstuvwxyz";
string Labc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

ll mod = ll(1e9) + 7;
ll INF  =ll(2e18);

int main() {
    cincout();
    ll s,b;
    cin >> n >> s >> b;
    ll nowh,nows;
    cin >> nowh;
    nows = s;
    rep(j,n-1){
        ll h;
        cin >> h;
        //cout << nowh << " " << nows << " " << h << endl;
        if(nowh >= h){
            if(h + s * b >= nowh + nows* b){
                nowh = h;
                nows = s;
            }
        }
        else{
            while(nowh < h){
                if(nows == 0){
                    cout << "No" << endl;
                    return 0;
                }
                nows--;
                nowh += b;
            }
            nowh = h;
            nows = s;
        }
    }
    cout << "Yes"<<endl;
    return 0;
}
0