蒟蒻求助一下
#include<bits/stdc++.h>
using namespace std;
double L,v,a[200010],s[200010],t,y;
int n,q,ans;
bool cmp(int r,int s){
return r>s;
}
int main(){
ios::sync_with_stdio(false);
cin>>n>>L>>v;
y=L/v;
for(int i=1;i<=n;i++){
cin>>a[i];
a[i]/=v;
}
sort(a+1,a+n+1,cmp);
for(int i=1;i<=n;i++){
s[i]=s[i-1]+a[i];
}
cin>>q;
while(q--){
cin>>t;
if(y+s[n]<=t){
cout<<-1<<endl;
}
else if(y>=t){
cout<<0<<endl;
}
else{
ans=upper_bound(s+1,s+n+1,t-y)-s;
cout<<ans<<endl;
}
}
return 0;
}