結果
問題 | No.1739 Princess vs. Dragoness (& AoE) |
ユーザー |
![]() |
提出日時 | 2021-11-12 22:06:04 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 361 ms / 3,000 ms |
コード長 | 734 bytes |
コンパイル時間 | 1,443 ms |
コンパイル使用メモリ | 172,224 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-25 18:45:00 |
合計ジャッジ時間 | 9,863 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 40 |
ソースコード
#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 = -1, 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;}