显示代码纯文本
#include<bits/stdc++.h>
#define int long long
#define mod 998244353
#define bianli for(int i=head[x];i;i=a[i].next)
#define QWQ cout<<"qwq";
#define me(qw) memset(qw,0,sizeof(qw));
#define meinf(qw) memset(qw,0x3f,sizeof(qw));
using namespace std;
const int maxn=2e5+5;
int s[maxn];
bool cmp(const int q,const int w){
return q>w;}
signed main(){
freopen("noi_online_endless.in","r",stdin);
freopen("noi_online_endless.out","w",stdout);
int n,l,v,q,p;cin>>n>>l>>v;
for(int i=1;i<=n;i++)
cin>>s[i];
sort(s+1,s+1+n,cmp);
s[1]+=l;
for(int i=2;i<=n;i++)s[i]+=s[i-1];
cin>>q;
for(int i=1;i<=q;i++){
cin>>p;p*=v;
if(p<l){cout<<0<<endl;continue;}
int ans=upper_bound(s+1,s+1+n,p)-s;
if(ans<=n)
cout<<ans<<endl;
else cout<<-1<<endl;
}
return 0;
}