結果

問題 No.2056 非力なレッド
ユーザー hiro71687k
提出日時 2023-08-28 21:58:10
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 781 bytes
コンパイル時間 4,071 ms
コンパイル使用メモリ 251,884 KB
最終ジャッジ日時 2025-02-16 15:23:32
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll mod=1000000007;
ll inf=10099999999999990;
int main(){
    ll n,x,m;
    cin>> n >> x >> m;
    vector<ll>a(n);
    vector<ll>b(n);
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
        for (ll j = 0; j >=0; j++)
        {
            if (x>a[i])
            {
                b[i]=j;
                break;
            }
            a[i]/=2;
        }
    }
    ll now=0;
    ll ans=0;
    for (ll i = n-1; i >=0; i--)
    {
        ans+=max(0LL,(b[i]-now)*(i+1));
        now=max(now,b[i]);
    }
    if (m>=ans)
    {
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
}
0