又是一个90pts的QWQ
查看原帖
又是一个90pts的QWQ
327193
利维坦楼主2021/7/27 14:01
#include<bits/stdc++.h>
using namespace std;

typedef unsigned long long LL;
const int N=200005;

LL a[N],h[N],n,s,L;

bool check(LL m){
	LL len=0ull;
	for(int i=1;i<=n;i++){
		h[i]+=m*a[i];
		if(h[i]>=L)len+=h[i];
		h[i]-=m*a[i];
	}
	return len>=s;
}

int main(){
	cin>>n>>s>>L;
	for(int i=1;i<=n;i++){
		cin>>h[i];
	}
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	LL l=1,r=1e18+5;
	while(l<=r){
		LL mid=(r+l)/2ll;
		if(check(mid))r=mid-1ll;
		else l=mid+1ll;
//		cout<<l<<" "<<r<<" "<<mid<<" "<<check(mid)<<endl;
	}
	cout<<l<<endl;
	return 0;
}
2021/7/27 14:01
加载中...