結果

問題 No.2056 非力なレッド
ユーザー んんんんんん
提出日時 2022-08-26 21:34:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 726 bytes
コンパイル時間 1,713 ms
コンパイル使用メモリ 166,272 KB
実行使用メモリ 6,484 KB
最終ジャッジ日時 2024-04-21 23:33:30
合計ジャッジ時間 4,836 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 WA -
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 WA -
testcase_14 AC 51 ms
5,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 36 ms
5,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 54 ms
5,376 KB
testcase_23 AC 45 ms
5,376 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 79 ms
5,376 KB
testcase_29 AC 80 ms
5,376 KB
testcase_30 AC 81 ms
5,376 KB
testcase_31 AC 79 ms
5,376 KB
testcase_32 AC 78 ms
5,376 KB
testcase_33 WA -
testcase_34 AC 85 ms
6,228 KB
testcase_35 WA -
testcase_36 AC 79 ms
5,376 KB
testcase_37 AC 83 ms
6,484 KB
testcase_38 AC 2 ms
5,376 KB
testcase_39 WA -
testcase_40 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int N, X, M;
int A[200009];

int main() {
    cin >> N >> X >> M;
    for (int i = 0; i < N; i++) cin >> A[i];
    vector<pair<int, int>> vp;
    for (int i = 0; i < N; i++) {
        if (A[i] >= X) {
            int cnt = 0;
            int val = 1;
            while (A[i]-X >= val) {
                cnt++;
                val *= 2;
            }
            vp.emplace_back(cnt, i+1);
        }
    }
    int sum_cnt = 0;
    int cost = 0;
    for (int i = vp.size()-1; i >= 0; i--) {
        cost += max(0, vp[i].second * (vp[i].first-sum_cnt));
        sum_cnt += max(0, vp[i].first-sum_cnt);
    }
    if (cost <= M) cout << "Yes" << endl;
    else cout << "No" << endl;
}
0