Submission #4038441


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,a,b;cin >> n >> a >> b;
	vector<ll> h(n);
	rep(i,n) cin >> h.at(i);
	ll l=0,r=1000000000;
	while(r-l>1){
		ll mid=(r+l)/2,sum=0;
		rep(i,n){
			if(h.at(i)>mid*b) sum+=(h.at(i)-mid*b+(a-b-1))/(a-b);
		}
		if(sum<=mid) r=mid;
		else l=mid;
	}
	cout << r << endl;
}

Submission Info

Submission Time
Task D - Widespread
User rhincodon66
Language C++14 (GCC 5.4.1)
Score 400
Code Size 525 Byte
Status AC
Exec Time 45 ms
Memory 1024 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 13
Set Name Test Cases
Sample a01, a02, a03
All a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13
Case Name Status Exec Time Memory
a01 AC 1 ms 256 KB
a02 AC 1 ms 256 KB
a03 AC 1 ms 256 KB
b04 AC 1 ms 256 KB
b05 AC 16 ms 1024 KB
b06 AC 45 ms 1024 KB
b07 AC 28 ms 1024 KB
b08 AC 23 ms 1024 KB
b09 AC 16 ms 1024 KB
b10 AC 14 ms 1024 KB
b11 AC 16 ms 1024 KB
b12 AC 17 ms 1024 KB
b13 AC 35 ms 1024 KB