Pagini recente » Cod sursa (job #511956) | Cod sursa (job #622108) | Cod sursa (job #3145995) | Cod sursa (job #2349708) | Cod sursa (job #2908175)
/*
Programmer : Alexandru Olteanu
*/
#include<bits/stdc++.h>
using namespace std;
// GCC Optimizations
// #pragma GCC optimize("Ofast");
// #pragma GCC target("fma,sse,sse2,sse3,ssse3,sse4,popcnt")
// #pragma GCC target("abm,mmx,avx,avx2,tune=native")
// #pragma GCC optimize(3)
// #pragma GCC optimize("inline")
// #pragma GCC optimize("-fgcse")
// #pragma GCC optimize("-fgcse-lm")
// #pragma GCC optimize("-fipa-sra")
// #pragma GCC optimize("-ftree-pre")
// #pragma GCC optimize("-ftree-vrp")
// #pragma GCC optimize("-fpeephole2")
// #pragma GCC optimize("-ffast-math")
// #pragma GCC optimize("-fsched-spec")
// #pragma GCC optimize("unroll-loops")
// Useful
mt19937 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());
#define FastEverything ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define HighPrecision cout<<fixed<<setprecision(17);
typedef long long ll;
typedef pair<int,int> pii;
ll const mod=1000000007LL;
ll const mod2 = 100000000LL;
ll const md=998244353LL;
ll mypowr(ll a,ll b, ll mod1) {ll res=1;if(b<0)b=0;a%=mod1; assert(b>=0);
for(;b;b>>=1){if(b&1)res=res*a%mod1;a=a*a%mod1;}return res;}
ll mypow(ll a,ll b) {ll res=1;if(b<0)b=0;assert(b>=0);
for(;b;b>>=1){if(b&1)res=res*a;a=a*a;}return res;}
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
ifstream in("secv3.in");
ofstream out("secv3.out");
#define cin in
#define cout out
const ll infll = 9e18;
const int inf = 2e9;
const ll maxn = 5e4 + 2;
int n, l, u;
int temp[maxn];
int cost[maxn];
double r1, r2;
int main()
{
FastEverything
HighPrecision
int test = 1;
// cin >> test;
for (int tt = 1; tt <= test; ++tt) {
cin >> n >> l >> u;
for(int i = 1; i <= n; i++) {
cin >> cost[i];
cost[i] += cost[i - 1];
}
for(int i = 1; i <= n; i++) {
cin >> temp[i];
temp[i] += temp[i - 1];
}
double res = 1.0L * cost[l] / temp[l];
int i, j;
j = 1;
for(i = l + 1; i <= n; i++) {
if(i == u + l)
j++;
r1 = 1.0L * (cost[i] - cost[j - 1]) / (1.0L * (temp[i] - temp[j - 1]));
r2 = 1.0L * (cost[i] - cost[i - l]) / (1.0L * (temp[i] - temp[i - l]));
if(r1 < r2) {
r1 = r2;
j = i - l + 1;
}
res = max(res, r1);
}
cout << res << '\n';
}
return 0;
}