Pagini recente » Cod sursa (job #3319485) | Cod sursa (job #2133640) | Cod sursa (job #2216419) | Cod sursa (job #2471366) | Cod sursa (job #3317225)
#include <bits/stdc++.h>
using namespace std;
int main()
{
#ifndef LOCAL
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
freopen("secv3.in", "r", stdin);
freopen("secv3.out", "w", stdout);
#endif
int N, L, U;
cin >> N >> L >> U;
vector<int> c(N + 2, 0), t(N + 2, 0);
for(int i = 1; i <= N; ++i)
cin >> c[i];
for(int i = 1; i <= N; ++i)
cin >> t[i];
vector<int> sc(N + 2, 0), st(N + 2, 0);
for(int i = 1; i <= N; ++i) {
sc[i] = sc[i-1] + c[i];
st[i] = st[i-1] + t[i];
}
double maxx = 0.0;
deque<int> dq;
for(int i = L; i <= N; ++i) {
while(!dq.empty() && i - dq.front() > U)
dq.pop_front();
while(!dq.empty() && sc[dq.back()] - maxx * st[dq.back()] > sc[i-L] - maxx * st[i-L])
dq.pop_back();
dq.push_back(i - L);
double r = (double)(sc[i] - sc[dq.front()]) / (double)(st[i] - st[dq.front()]);
maxx = max(r, maxx);
}
cout << fixed << setprecision(2) << maxx;
return 0;
}