結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー nok0nok0
提出日時 2021-11-01 15:31:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 735 ms / 3,000 ms
コード長 661 bytes
コンパイル時間 2,362 ms
コンパイル使用メモリ 204,656 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-04 04:23:05
合計ジャッジ時間 16,672 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 649 ms
5,376 KB
testcase_05 AC 731 ms
5,376 KB
testcase_06 AC 274 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 208 ms
5,376 KB
testcase_09 AC 333 ms
5,376 KB
testcase_10 AC 331 ms
5,376 KB
testcase_11 AC 202 ms
5,376 KB
testcase_12 AC 26 ms
5,376 KB
testcase_13 AC 415 ms
5,376 KB
testcase_14 AC 474 ms
5,376 KB
testcase_15 AC 526 ms
5,376 KB
testcase_16 AC 338 ms
5,376 KB
testcase_17 AC 264 ms
5,376 KB
testcase_18 AC 417 ms
5,376 KB
testcase_19 AC 201 ms
5,376 KB
testcase_20 AC 85 ms
5,376 KB
testcase_21 AC 378 ms
5,376 KB
testcase_22 AC 492 ms
5,376 KB
testcase_23 AC 706 ms
5,376 KB
testcase_24 AC 726 ms
5,376 KB
testcase_25 AC 719 ms
5,376 KB
testcase_26 AC 676 ms
5,376 KB
testcase_27 AC 723 ms
5,376 KB
testcase_28 AC 685 ms
5,376 KB
testcase_29 AC 721 ms
5,376 KB
testcase_30 AC 725 ms
5,376 KB
testcase_31 AC 735 ms
5,376 KB
testcase_32 AC 710 ms
5,376 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 2 ms
5,376 KB
testcase_35 AC 2 ms
5,376 KB
testcase_36 AC 2 ms
5,376 KB
testcase_37 AC 1 ms
5,376 KB
testcase_38 AC 3 ms
5,376 KB
testcase_39 AC 4 ms
5,376 KB
testcase_40 AC 2 ms
5,376 KB
testcase_41 AC 3 ms
5,376 KB
testcase_42 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define __GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

#define rep(i, x) for(int i = 0; i < (x); i++)

int main() {
	int n, a, b, x, y;
	cin >> n >> a >> b >> x >> y;
	vector h(n, 0);
	for(auto &v : h) cin >> v;

	auto f = [&](int k) {
		priority_queue<int> pq;
		for(auto &v : h) pq.push(v - k);
		rep(i, a) {
			if(pq.top() <= 0) break;
			pq.push(pq.top() - x);
			pq.pop();
		}
		long long sum = 0;
		while(!pq.empty()) {
			sum += max(pq.top(), 0);
			pq.pop();
		}
		return sum <= (long long)y * b;
	};

	int ok = 1000000000, ng = -1;
	while(ok - ng > 1) {
		int mid = (ok + ng) >> 1;
		(f(mid) ? ok : ng) = mid;
	}

	cout << ok << '\n';
}
0