結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー 沙耶花沙耶花
提出日時 2021-11-12 21:25:35
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 862 ms / 3,000 ms
コード長 842 bytes
コンパイル時間 4,266 ms
コンパイル使用メモリ 261,980 KB
実行使用メモリ 7,540 KB
最終ジャッジ日時 2023-08-16 21:25:50
合計ジャッジ時間 22,432 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 4 ms
4,380 KB
testcase_04 AC 778 ms
7,204 KB
testcase_05 AC 862 ms
7,540 KB
testcase_06 AC 340 ms
7,196 KB
testcase_07 AC 5 ms
4,380 KB
testcase_08 AC 253 ms
5,384 KB
testcase_09 AC 403 ms
6,940 KB
testcase_10 AC 393 ms
4,724 KB
testcase_11 AC 301 ms
4,380 KB
testcase_12 AC 29 ms
4,384 KB
testcase_13 AC 498 ms
5,620 KB
testcase_14 AC 567 ms
6,308 KB
testcase_15 AC 627 ms
7,380 KB
testcase_16 AC 403 ms
4,384 KB
testcase_17 AC 314 ms
5,044 KB
testcase_18 AC 493 ms
5,120 KB
testcase_19 AC 238 ms
5,284 KB
testcase_20 AC 102 ms
4,384 KB
testcase_21 AC 450 ms
6,548 KB
testcase_22 AC 588 ms
6,996 KB
testcase_23 AC 840 ms
7,316 KB
testcase_24 AC 847 ms
7,192 KB
testcase_25 AC 857 ms
7,380 KB
testcase_26 AC 815 ms
7,236 KB
testcase_27 AC 849 ms
7,372 KB
testcase_28 AC 813 ms
7,416 KB
testcase_29 AC 854 ms
7,276 KB
testcase_30 AC 838 ms
7,532 KB
testcase_31 AC 815 ms
7,188 KB
testcase_32 AC 828 ms
7,324 KB
testcase_33 AC 1 ms
4,384 KB
testcase_34 AC 2 ms
4,380 KB
testcase_35 AC 3 ms
4,384 KB
testcase_36 AC 2 ms
4,380 KB
testcase_37 AC 2 ms
4,380 KB
testcase_38 AC 3 ms
4,380 KB
testcase_39 AC 4 ms
4,380 KB
testcase_40 AC 3 ms
4,384 KB
testcase_41 AC 3 ms
4,380 KB
testcase_42 AC 2 ms
4,380 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