Pagini recente » Cod sursa (job #3305430) | Istoria paginii jc2025 | Cod sursa (job #3349806) | Cod sursa (job #3350589) | Cod sursa (job #3355315)
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
int main() {
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
freopen("secv3.in","r",stdin);
freopen("secv3.out","w",stdout);
int n,l,r;
cin>>n>>l>>r;
vector<int> c(n),t(n);
for(auto&x:c)cin>>x;
for(auto&x:t)cin>>x;
vector<ld> s(n+1);
auto isok=[&](ld val) {
for(int i=0;i<n;i++){
s[i+1]=s[i]+c[i]-t[i]*val;
}
for(int len=l;len<=r;len++){
for(int i=0;i+len-1<n;i++) {
if(s[i+len]-s[i]>=0){
return 1;
}
}
}
return 0;
};
ld low=0,high=1e9;
for(int it=1;it<=200;it++){
ld mid=(low+high)/2;
if(isok(mid)){
low=mid;
}else{
high=mid;
}
}
cout<<fixed<<setprecision(2)<<low<<"\n";
return 0;
}