結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー CleyLCleyL
提出日時 2021-12-25 11:41:42
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,079 bytes
コンパイル時間 709 ms
コンパイル使用メモリ 76,796 KB
実行使用メモリ 5,944 KB
最終ジャッジ日時 2023-10-21 12:24:43
合計ジャッジ時間 16,913 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 WA -
testcase_04 AC 540 ms
5,680 KB
testcase_05 AC 837 ms
5,944 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 236 ms
4,808 KB
testcase_09 AC 296 ms
5,036 KB
testcase_10 AC 252 ms
4,348 KB
testcase_11 WA -
testcase_12 AC 6 ms
4,348 KB
testcase_13 WA -
testcase_14 AC 545 ms
5,468 KB
testcase_15 AC 479 ms
5,676 KB
testcase_16 AC 365 ms
4,348 KB
testcase_17 AC 231 ms
4,492 KB
testcase_18 AC 407 ms
4,476 KB
testcase_19 AC 62 ms
4,348 KB
testcase_20 WA -
testcase_21 AC 225 ms
5,008 KB
testcase_22 AC 455 ms
5,588 KB
testcase_23 AC 499 ms
5,940 KB
testcase_24 AC 813 ms
5,940 KB
testcase_25 AC 744 ms
5,676 KB
testcase_26 WA -
testcase_27 AC 800 ms
5,936 KB
testcase_28 WA -
testcase_29 AC 806 ms
5,936 KB
testcase_30 AC 589 ms
5,676 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 2 ms
4,348 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 2 ms
4,348 KB
testcase_39 AC 3 ms
4,348 KB
testcase_40 AC 2 ms
4,348 KB
testcase_41 AC 2 ms
4,348 KB
testcase_42 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
long long n,a,b,x,y;
vector<long long> R;
bool solve(long long ce){
    int nwa = a;
    priority_queue<long long,vector<long long>> A;
    for(int i = 0; n > i; i++){
      
        if(R[i]-ce > 0){
          A.push(R[i]-ce);
        }
    }
    while(nwa){
        if(A.size() == 0){
          return true;
        }
        auto z = A.top();A.pop();
        if(z > x){
            A.push(z-x);
        }
        nwa--;
    }
    long long size = 0;
    while(A.size()){
        auto z = A.top();A.pop();
        size+=z;
    }
    if(size > b*y){
      if(ce == 6)cout << size << " " << b*y << endl;
        return false;
    }else{
      
        return true;
    }
    

}

int main(){
  cin>>n>>a>>b>>x>>y;
  for(int i = 0; n > i; i++){
    int t;cin>>t;
    R.push_back(t);
  }
  long long mn = 0;
  long long mx = 1000000000;
  while(abs(mn-mx) > 1){
    long long ce = (mn+mx)/2;
    if(solve(ce)){
      mx = ce;
    }else{
      mn = ce;
    }
  }
  cout << mx << endl;
}
0