結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー ゆにぽけゆにぽけ
提出日時 2023-10-19 09:39:46
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 562 ms / 3,000 ms
コード長 1,008 bytes
コンパイル時間 1,340 ms
コンパイル使用メモリ 132,080 KB
実行使用メモリ 5,900 KB
最終ジャッジ日時 2023-10-19 09:40:02
合計ジャッジ時間 12,911 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 9 ms
4,348 KB
testcase_04 AC 462 ms
5,900 KB
testcase_05 AC 546 ms
5,900 KB
testcase_06 AC 363 ms
5,900 KB
testcase_07 AC 11 ms
4,348 KB
testcase_08 AC 63 ms
4,768 KB
testcase_09 AC 100 ms
5,712 KB
testcase_10 AC 300 ms
4,472 KB
testcase_11 AC 229 ms
4,348 KB
testcase_12 AC 8 ms
4,348 KB
testcase_13 AC 300 ms
4,832 KB
testcase_14 AC 355 ms
5,424 KB
testcase_15 AC 289 ms
5,896 KB
testcase_16 AC 343 ms
4,348 KB
testcase_17 AC 161 ms
4,516 KB
testcase_18 AC 393 ms
4,508 KB
testcase_19 AC 78 ms
4,512 KB
testcase_20 AC 36 ms
4,348 KB
testcase_21 AC 167 ms
5,696 KB
testcase_22 AC 291 ms
5,808 KB
testcase_23 AC 554 ms
5,896 KB
testcase_24 AC 538 ms
5,896 KB
testcase_25 AC 546 ms
5,896 KB
testcase_26 AC 532 ms
5,896 KB
testcase_27 AC 550 ms
5,892 KB
testcase_28 AC 547 ms
5,896 KB
testcase_29 AC 551 ms
5,896 KB
testcase_30 AC 562 ms
5,896 KB
testcase_31 AC 527 ms
5,896 KB
testcase_32 AC 548 ms
5,900 KB
testcase_33 AC 3 ms
4,348 KB
testcase_34 AC 2 ms
4,348 KB
testcase_35 AC 2 ms
4,348 KB
testcase_36 AC 3 ms
4,348 KB
testcase_37 AC 2 ms
4,348 KB
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<cstring>
#include<cassert>
#include<cmath>
#include<ctime>
#include<iomanip>
#include<numeric>
#include<stack>
#include<queue>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<bitset>
#include<random>
using namespace std;
int N,A,B,X,Y,H[1 << 17];
void solve()
{
	cin >> N >> A >> B >> X >> Y;
	for(int i = 0;i < N;i++) cin >> H[i];
	int ng = -1,ok = (int)1e9;
	while(ok-ng > 1)
	{
		int mid = (ok+ng)/2;
		vector<int> h(N);
		priority_queue<pair<int,int>> Q;
		for(int i = 0;i < N;i++) h[i] = H[i]-mid,Q.push(make_pair(h[i],i));
		for(int i = 0;i < A;i++)
		{
			int id = Q.top().second;
			Q.pop();
			h[id] -= X;
			Q.push(make_pair(h[id],id));
		}
		long long S = 0;
		for(int i = 0;i < N;i++) S += max(0,h[i]);
		if(S <= (long long)Y*B) ok = mid;
		else ng = mid;
	}
	cout << ok << endl;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int tt = 1;
	//cin >> tt;
	while(tt--) solve();
}
0