Pagini recente » Cod sursa (job #2113756) | Cod sursa (job #1160562) | Cod sursa (job #2364205) | Cod sursa (job #464833) | Cod sursa (job #2059319)
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e4 + 5;
int n, l, u;
int c[MAXN], t[MAXN];
#define BUF 1 << 17
char buf[BUF];
int pos = BUF;
inline char next() {
if(pos == BUF)
fread(buf, 1, BUF, stdin), pos = 0;
return buf[pos++];
}
inline int read() {
int x = 0;
char ch = next();
while(!isdigit(ch))
ch = next();
while(isdigit(ch))
x = x * 10 + ch - '0', ch = next();
return x;
}
int q[MAXN], st = 1, dr = 1;
double maxi(double a, double b) {
if(a < b)
return b;
return a;
}
int main() {
freopen("secv3.in", "r", stdin);
freopen("secv3.out", "w", stdout);
n = read(), l = read(), u = read();
for(int i = 1;i <= n;i++)
c[i] = read(), c[i] += c[i - 1];
for(int i = 1;i <= n;i++)
t[i] = read(), t[i] += t[i - 1];
double ans = 1.0 * c[l] / t[l];
st = 1, dr = 0;
for(int i = l;i <= n;i++) {
while(st <= dr && q[st] <= i - u)
st++;
while(st <= dr && 1LL * (c[i] - c[q[dr] - 1]) * (t[i] - t[i - l]) < 1LL * (c[i] - c[i - l]) * (t[i] - t[q[dr] - 1]))
dr--;
q[++dr] = i - l + 1;
if(ans < 1.0 * (c[i] - c[q[st] - 1]) / (t[i] - t[q[st] - 1]))
ans = 1.0 * (c[i] - c[q[st] - 1]) / (t[i] - t[q[st] - 1]);
}
printf("%.2lf", ans);
return 0;
}