結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー ktr216ktr216
提出日時 2021-11-12 22:16:48
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 797 ms / 3,000 ms
コード長 819 bytes
コンパイル時間 1,809 ms
コンパイル使用メモリ 169,880 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-08-17 01:59:34
合計ジャッジ時間 16,702 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 6 ms
4,376 KB
testcase_04 AC 571 ms
4,376 KB
testcase_05 AC 797 ms
4,380 KB
testcase_06 AC 306 ms
4,380 KB
testcase_07 AC 6 ms
4,376 KB
testcase_08 AC 229 ms
4,376 KB
testcase_09 AC 316 ms
4,380 KB
testcase_10 AC 289 ms
4,380 KB
testcase_11 AC 176 ms
4,376 KB
testcase_12 AC 10 ms
4,376 KB
testcase_13 AC 343 ms
4,376 KB
testcase_14 AC 530 ms
4,376 KB
testcase_15 AC 493 ms
4,380 KB
testcase_16 AC 371 ms
4,376 KB
testcase_17 AC 244 ms
4,376 KB
testcase_18 AC 433 ms
4,376 KB
testcase_19 AC 101 ms
4,380 KB
testcase_20 AC 94 ms
4,380 KB
testcase_21 AC 273 ms
4,380 KB
testcase_22 AC 467 ms
4,444 KB
testcase_23 AC 545 ms
4,376 KB
testcase_24 AC 778 ms
4,376 KB
testcase_25 AC 746 ms
4,380 KB
testcase_26 AC 581 ms
4,376 KB
testcase_27 AC 779 ms
4,380 KB
testcase_28 AC 585 ms
4,376 KB
testcase_29 AC 781 ms
4,384 KB
testcase_30 AC 623 ms
4,508 KB
testcase_31 AC 629 ms
4,496 KB
testcase_32 AC 772 ms
4,376 KB
testcase_33 AC 1 ms
4,376 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 2 ms
4,380 KB
testcase_36 AC 2 ms
4,380 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 AC 3 ms
4,376 KB
testcase_39 AC 3 ms
4,376 KB
testcase_40 AC 2 ms
4,376 KB
testcase_41 AC 2 ms
4,380 KB
testcase_42 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, l, r) for (int i = (l); i < (r); i++)
using namespace std;

typedef long long ll;

int main() {
    int N, A, B, X, Y;
    cin >> N >> A >> B >> X >> Y;
    vector<int> H(N);
    rep(i, 0, N) cin >> H[i];
    int ok = 1e9, ng = -1;
    while (ok > ng + 1) {
        int md = (ok + ng) / 2;
        priority_queue<int> pq;
        rep(i, 0, N) {
            pq.push(max(0, H[i] - md));
        }
        rep(i, 0, A) {
            int p = pq.top();
            pq.pop();
            pq.push(max(0, p - X));
        }
        ll S = 0;
        while (!pq.empty()) {
            int p = pq.top();
            pq.pop();
            S += p;
            //cout << "p=" << p << endl;
        }
        if (1LL * Y * B >= S) ok = md;
        else ng = md;
    }
    cout << ok << endl;
}
0