結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー 沙耶花沙耶花
提出日時 2021-11-12 21:25:35
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 780 ms / 3,000 ms
コード長 842 bytes
コンパイル時間 4,594 ms
コンパイル使用メモリ 264,644 KB
実行使用メモリ 7,544 KB
最終ジャッジ日時 2024-05-04 04:49:23
合計ジャッジ時間 19,817 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 4 ms
5,376 KB
testcase_04 AC 713 ms
7,412 KB
testcase_05 AC 780 ms
7,544 KB
testcase_06 AC 298 ms
7,540 KB
testcase_07 AC 5 ms
5,376 KB
testcase_08 AC 234 ms
5,628 KB
testcase_09 AC 374 ms
7,068 KB
testcase_10 AC 366 ms
5,376 KB
testcase_11 AC 272 ms
5,376 KB
testcase_12 AC 26 ms
5,376 KB
testcase_13 AC 451 ms
5,820 KB
testcase_14 AC 544 ms
6,536 KB
testcase_15 AC 569 ms
7,528 KB
testcase_16 AC 366 ms
5,376 KB
testcase_17 AC 290 ms
5,588 KB
testcase_18 AC 443 ms
5,436 KB
testcase_19 AC 213 ms
5,376 KB
testcase_20 AC 90 ms
5,376 KB
testcase_21 AC 399 ms
6,852 KB
testcase_22 AC 548 ms
7,160 KB
testcase_23 AC 770 ms
7,408 KB
testcase_24 AC 762 ms
7,404 KB
testcase_25 AC 770 ms
7,408 KB
testcase_26 AC 752 ms
7,528 KB
testcase_27 AC 763 ms
7,396 KB
testcase_28 AC 739 ms
7,404 KB
testcase_29 AC 775 ms
7,520 KB
testcase_30 AC 766 ms
7,400 KB
testcase_31 AC 742 ms
7,392 KB
testcase_32 AC 752 ms
7,412 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 2 ms
5,376 KB
testcase_35 AC 3 ms
5,376 KB
testcase_36 AC 3 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
testcase_38 AC 3 ms
5,376 KB
testcase_39 AC 5 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 #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000001

int N,A,B;
long long x,y;

bool check(vector<long long> a){
	
	priority_queue<long long> Q;
	rep(i,N){
		Q.push(a[i]);
	}
	
	rep(i,A){
		auto t = Q.top();
		Q.pop();
		t -= x;
		Q.push(t);
	}
	long long AA = y*B;
	while(Q.size()>0){
		auto t = Q.top();
		Q.pop();
		AA -= max(0LL,t);
	}
	
	if(AA>=0)return true;
	else return false;
		
	
}

int main(){
	
	
	cin>>N>>A>>B;
	
	
	cin>>x>>y;
	vector<long long> a(N);
	rep(i,N)cin>>a[i];
	
	long long ok = Inf,ng = -1;
	while(ok-ng>1LL){
		long long mid = (ok+ng)/2;
		auto b = a;
		rep(i,N)b[i] -= mid;
		
		if(check(b))ok = mid;
		else ng = mid;
	}
	cout<<ok<<endl;
	
	
	return 0;
}
0