记录编号 575168 评测结果 RRRRRRRRRR
题目名称 3734.van玩galgame 最终得分 0
用户昵称 ムラサメ 是否通过 未通过
代码语言 C++ 运行时间 0.000 s
提交时间 2022-09-06 16:00:19 内存使用 0.00 MiB
显示代码纯文本
#include<bits/stdc++.h>
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(){
	freopen("noi_online_endless.in","r",stdin);
	freopen("noi_online_endless.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	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"<<endl;
			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<<endl;
	}
	return 0;
}