結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー granddaifukugranddaifuku
提出日時 2021-11-15 23:48:20
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,234 bytes
コンパイル時間 1,824 ms
コンパイル使用メモリ 172,840 KB
実行使用メモリ 5,764 KB
最終ジャッジ日時 2023-08-21 18:43:25
合計ジャッジ時間 12,005 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 WA -
testcase_04 AC 373 ms
5,716 KB
testcase_05 AC 553 ms
5,580 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 158 ms
4,496 KB
testcase_09 AC 191 ms
4,672 KB
testcase_10 AC 173 ms
4,380 KB
testcase_11 WA -
testcase_12 AC 3 ms
4,380 KB
testcase_13 WA -
testcase_14 AC 367 ms
5,348 KB
testcase_15 AC 335 ms
5,580 KB
testcase_16 AC 257 ms
4,376 KB
testcase_17 AC 161 ms
4,380 KB
testcase_18 AC 269 ms
4,380 KB
testcase_19 AC 39 ms
4,380 KB
testcase_20 WA -
testcase_21 AC 136 ms
4,432 KB
testcase_22 AC 312 ms
5,320 KB
testcase_23 AC 328 ms
5,628 KB
testcase_24 AC 548 ms
5,700 KB
testcase_25 AC 477 ms
5,432 KB
testcase_26 WA -
testcase_27 AC 520 ms
5,628 KB
testcase_28 WA -
testcase_29 AC 515 ms
5,764 KB
testcase_30 AC 407 ms
5,712 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 1 ms
4,380 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 2 ms
4,376 KB
testcase_39 AC 2 ms
4,376 KB
testcase_40 AC 2 ms
4,384 KB
testcase_41 AC 2 ms
4,376 KB
testcase_42 AC 2 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for (int i = a; i < (int)b; ++i)
#define rrep(i, n) for (int i = ((int)n - 1); i >= 0; --i)

using ll = long long;
using ld = long double;

__attribute__((unused)) const ll INF = 1e18;
__attribute__((unused)) const int Inf = 1e9;
__attribute__((unused)) const double EPS = 1e-9;
__attribute__((unused)) const ll MOD = 1000000007;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(0);
  int n;
  ll a, b, x, y;
  cin >> n >> a >> b >> x >> y;
  vector<ll> h(n);
  rep(i, n) { cin >> h[i]; }
  sort(h.begin(), h.end());
  ll left = 0LL, right = INF, mid;
  while (right - left > 1) {
    mid = (left + right) / 2;
    priority_queue<ll> pq;
    rep(i, n) {
      ll tmp = h[i] - mid;
      if (tmp <= 0) continue;
      pq.push(tmp);
    }
    rep(i, a) {
      if (pq.size() == 0) break;
      ll t = pq.top();
      pq.pop();
      t -= x;
      if (t <= 0) continue;
      pq.push(t);
    }
    ll lim = y * b;
    while (!pq.empty()) {
      ll t = pq.top();
      pq.pop();
      lim -= t;
    }
    if (lim >= 0)
      right = mid;
    else
      left = mid;
  }
  cout << right << endl;

  return 0;
}
0