0
已解决
汪恺恒
中级启示者
中级启示者
WA5
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
double b[200001],l,q,t,v,a[200001];
long long n;
int cmp(double x,double y){
return x>y;
}
int main(){
cin>>n>>l>>v;
for(int i=1;i<=n;i++){
cin>>a[i];
}
sort(a+1,a+1+n,cmp);
b[0]=l/v;
for(int i=1;i<=n;i++){
b[i]=double(a[i])/v+b[i-1];
}
cin>>q;
while(q--){
cin>>t;
if(b[n]<=t){
cout<<-1;
continue;
}
int l=0,r=n,ans=0;
while(l<=r){
int mid=(l+r)>>1;
if(b[mid]>t){
ans=mid;
r=mid-1;
}
else{
l=mid+1;
}
}
cout<<ans;
}
return 0;
}