結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー houren
提出日時 2021-11-12 22:04:12
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 733 bytes
コンパイル時間 1,778 ms
コンパイル使用メモリ 172,828 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-25 18:39:24
合計ジャッジ時間 11,079 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()

int main(){
    ll n,a,b,x,y;
    cin >> n >> a >> b >> x >> y;
    priority_queue<ll> h;
    rep(i,n){
        ll z;
        cin >> z;
        h.push(z);
    }
    rep(i,a){
        h.push(h.top()-x);
        h.pop();
    }
    ll be = 0, en = 1000000001;
    while(en-be!=1){
        ll md = (be+en)/2;
        priority_queue<ll> h2 = h;
        ll tot = 0;
        while(h2.size()){
            tot += max(0LL, h2.top()-md);
            h2.pop();
        }
        if(tot<=b*y) en = md;
        else be = md;
    }
    cout << en << endl;
    return 0;
}
0