#pragma GCC optimize("Ofast") #pragma GCC target("avx2") char*mmap(); #define rd(v) long v=0;{long _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;} #define wt(v) {long _z=v;do*--wp=_z%10+48;while(_z/=10);} #define rep(v,e) for(long v=0;v>8|a[i]<<24; } } void radix_sort(unsigned*a,unsigned*b,int n){ radix_sort_aux(a,b,n); radix_sort_aux(b,a,n); radix_sort_aux(a,b,n); radix_sort_aux(b,a,n); } int h[100000]; int q[100000]; void f2(long n,long a,long b,long x){ long hr=n,qr=0,qw=0; rep(i,a){ long c; if(qr==qw||h[hr-1]>q[qr]){ c=h[--hr]; }else{ c=q[qr++]; } c-=x; q[qw++]=c>=0?c:0; } f3(n,b,hr,qr,qw); } void f3(long n,long b,long hr,long qr,long qw){ long m=0; while(1){ long d=n-(hr+qw-qr); if(d==n){ output(0); } long c; if(qr==qw||h[hr-1]>q[qr]){ c=h[--hr]; }else{ c=q[qr++]; } if(b<=d*(m-c)){ output(d?m-b/d:c); } b-=d*(m-c); m=c; } } main(){ char*rp=mmap(0l,1l<<25,1,2,0,0ll); rd(n); rd(a); rd(b); rd(x); { rd(y); b*=y; } rep(i,n){ rd(hi); h[i]=hi; } radix_sort(h,q,n); f2(n,a,b,x); }