#include #include #include #include #include using namespace std; using ll = long long; ll max(ll a, ll b){ if(a > b){ return a; } else return b; } ll sumVector(const vector& v){ ll sum = 0; for(size_t i=0; i h){ vector c(n, 0); for(int i = 0; i < n; i++){ c[i] = max(0, h[i] - k); } for(int i =0; i < n; i++){ ll d = min(a, c[i] / x); a -= d; c[i] -= x * d; } sort(c.begin(), c.end(), greater()); for(int i = 0; i < n; i++){ if(a > 0){ c[i] = 0; a--; } } if (sumVector(c) <= b * y){ return 1; } else return 0; } using namespace std; int main(void){ // Your code here! ll n, a, b, x, y; cin >> n >> a >> b >> x >> y; vector h(n, 0); for(int i = 0; i < n; i++){ cin >> h[i]; } ll ok = 10e9; ll ng = -1; while(ok - ng > 1){ ll mid = (ok + ng) / 2; if(is_ok(mid, n, a, b, x, y, h)){ ok = mid; } else ng = mid; } cout << ok << endl; }