結果

問題 No.2056 非力なレッド
ユーザー やうやう
提出日時 2022-08-26 21:39:37
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 741 bytes
コンパイル時間 1,926 ms
コンパイル使用メモリ 176,220 KB
実行使用メモリ 17,536 KB
最終ジャッジ日時 2024-10-13 22:09:01
合計ジャッジ時間 14,235 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 WA * 11 TLE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
using V=vector<ll>;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)

int main(){
    ll n,x,m;
    cin >> n >> x >> m;
    V a(n);
    set<P> s;
    rep(i,n){
        cin >> a[i];
        s.insert(P(a[i],i));
    }

    ll M;

    while(m){
        auto i=s.end(); --i;
        int k=min(m,(*i).second+1);
        rep(j,k){
            s.erase(P(a[j],j));
            a[j]/=2;
            s.insert(P(a[j],j));
        }
        m-=k;
        M=0;
        rep(j,n) M=max(M,a[j]);
        if(M<=x){
            cout << "Yes" << endl;
            return 0;
        }
    }
    
    cout << "No" << endl;

}
0