結果

問題 No.2056 非力なレッド
ユーザー rogi52
提出日時 2022-08-26 21:25:35
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 517 bytes
コンパイル時間 1,728 ms
コンパイル使用メモリ 194,408 KB
最終ジャッジ日時 2025-01-31 04:14:46
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int N,X,M; cin >> N >> X >> M;
    vector<int> A(N);
    rep(i,N) cin >> A[i];
    int cnt = 0, cost = 0;
    for(int i = N - 1; i >= 0; i--) {
        rep(_,cnt) A[i] /= 2;
        while(X <= A[i]) {
            A[i] /= 2;
            cnt++;
            cost += i + 1;
        }
    }

    cout << (cost <= M ? "Yes" : "No") << endl;
}
0