結果
| 問題 |
No.1739 Princess vs. Dragoness (& AoE)
|
| コンテスト | |
| ユーザー |
googol_S0
|
| 提出日時 | 2021-11-12 21:56:09 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 800 ms / 3,000 ms |
| コード長 | 613 bytes |
| コンパイル時間 | 1,813 ms |
| コンパイル使用メモリ | 197,224 KB |
| 最終ジャッジ日時 | 2025-01-25 16:36:03 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 40 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ll N,A,B,X,Y;
cin>>N>>A>>B>>X>>Y;
vector<ll> H(N);
for(int i=0;i<N;i++){
cin>>H[i];
}
ll L=0;
ll R=1000000000;
ll M,x;
while(L<R){
M=(L+R)>>1;
priority_queue<ll> que;
for(int i=0;i<N;i++){
que.push(max(0LL,H[i]-M));
}
for(int i=0;i<A;i++){
x=que.top();
que.pop();
x=max(0LL,x-X);
que.push(x);
}
x=0;
while(!que.empty()){
x+=que.top();
que.pop();
}
if(x<=B*Y){
R=M;
}else{
L=max(L+1,M);
}
}
cout<<L<<"\n";
}
googol_S0