結果

問題 No.2056 非力なレッド
ユーザー _yurimoir_yurimoir
提出日時 2022-10-18 10:59:39
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 601 bytes
コンパイル時間 2,780 ms
コンパイル使用メモリ 245,644 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 19:58:29
合計ジャッジ時間 6,639 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,x,m;
    cin>>n>>x>>m;
    vector<int> a(n);
    for(auto& x:a)cin>>x;
    vector<int> tank(n,0);
    for(int i=0;i<n;i++){
        int cnt=0;
        while(x<=a[i]){
            a[i]=a[i]>>1;
            cnt++;
        }
        tank[i]=cnt;
    }
    int mgc=0;
    for(int i=n-1;i>=0;i--){
        if(tank[i]>mgc){
            m-=(tank[i]-mgc)*(i+1);
            mgc+=tank[i]-mgc;
            if(m<0){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}
0