結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー granddaifukugranddaifuku
提出日時 2021-11-15 23:18:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,224 bytes
コンパイル時間 3,371 ms
コンパイル使用メモリ 170,536 KB
実行使用メモリ 4,872 KB
最終ジャッジ日時 2023-08-21 18:22:03
合計ジャッジ時間 7,095 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 24 ms
4,376 KB
testcase_09 AC 36 ms
4,380 KB
testcase_10 AC 22 ms
4,380 KB
testcase_11 WA -
testcase_12 AC 5 ms
4,376 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 22 ms
4,376 KB
testcase_20 WA -
testcase_21 AC 38 ms
4,376 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
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,380 KB
testcase_40 WA -
testcase_41 AC 2 ms
4,376 KB
testcase_42 AC 2 ms
4,380 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;
    vector<ll> tmp = h;
    rep(i, n) tmp[i] -= mid;
    ll lim = y * b;
    rep(i, n) {
      if (tmp[i] <= 0) continue;
      if (lim >= tmp[i]) {
        lim -= tmp[i];
        tmp[i] = 0;
      } else {
        tmp[i] -= lim;
        break;
      }
    }
    ll cnt = 0;
    rep(i, n) {
      if (tmp[i] <= 0) continue;
      cnt += (tmp[i] + x - 1) / x;
    }
    if (cnt <= a) {
      right = mid;
    } else {
      left = mid;
    }
  }
  cout << right << endl;

  return 0;
}
0