結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー googol_S0googol_S0
提出日時 2021-11-12 21:56:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 874 ms / 3,000 ms
コード長 613 bytes
コンパイル時間 2,278 ms
コンパイル使用メモリ 203,404 KB
実行使用メモリ 5,836 KB
最終ジャッジ日時 2023-08-17 01:16:10
合計ジャッジ時間 18,559 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 5 ms
4,376 KB
testcase_04 AC 629 ms
5,608 KB
testcase_05 AC 874 ms
5,708 KB
testcase_06 AC 342 ms
5,648 KB
testcase_07 AC 5 ms
4,380 KB
testcase_08 AC 253 ms
4,564 KB
testcase_09 AC 354 ms
5,276 KB
testcase_10 AC 311 ms
4,380 KB
testcase_11 AC 190 ms
4,376 KB
testcase_12 AC 11 ms
4,380 KB
testcase_13 AC 373 ms
4,624 KB
testcase_14 AC 576 ms
5,124 KB
testcase_15 AC 558 ms
5,660 KB
testcase_16 AC 391 ms
4,380 KB
testcase_17 AC 266 ms
4,380 KB
testcase_18 AC 461 ms
4,376 KB
testcase_19 AC 115 ms
4,380 KB
testcase_20 AC 102 ms
4,376 KB
testcase_21 AC 311 ms
5,248 KB
testcase_22 AC 516 ms
5,612 KB
testcase_23 AC 605 ms
5,596 KB
testcase_24 AC 852 ms
5,560 KB
testcase_25 AC 812 ms
5,648 KB
testcase_26 AC 643 ms
5,580 KB
testcase_27 AC 848 ms
5,652 KB
testcase_28 AC 647 ms
5,836 KB
testcase_29 AC 858 ms
5,712 KB
testcase_30 AC 688 ms
5,660 KB
testcase_31 AC 693 ms
5,596 KB
testcase_32 AC 847 ms
5,704 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 3 ms
4,376 KB
testcase_36 AC 2 ms
4,376 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 AC 3 ms
4,380 KB
testcase_39 AC 3 ms
4,376 KB
testcase_40 AC 2 ms
4,380 KB
testcase_41 AC 2 ms
4,376 KB
testcase_42 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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";
}
0