Cod sursa(job #2890822)

Utilizator minecraft3Vintila Valentin Ioan minecraft3 Data 16 aprilie 2022 19:18:59
Problema Secventa 3 Scor 80
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 1.6 kb
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")

using namespace std;
// using namespace __gnu_pbds;
// template<typename T>
// using oset = tree<T, null_type, less<T>,
				  // rb_tree_tag, tree_order_statistics_node_update>;

#define nl cout.put('\n')
using ll = long long;
using ull = unsigned long long;

#ifdef Wi_TEST
	template<typename T1, typename T2>
	ostream& operator<<(ostream& out, pair<T1,T2> p) {
		out << "(" << p.first << ", " << p.second << ")";
		out.flush(); return out;
	}
	void DEB() { cerr << "]" << endl; }
	template<typename H, typename ... T>
	void DEB(H h, T... t) {
		cerr << h;
		if(sizeof...(t)) cerr << ", ";
		DEB(t...);
	}
	#define deb(...) cerr << "LINE(" << __LINE__ << ") -> [" << \
						     #__VA_ARGS__ << "]: [", DEB(__VA_ARGS__)
#else
	#define deb(...) 87105
#endif

const long long MOD = 1000000007, MOD2 = 998244353;
int lx[] = {0, 1, 0, -1}, ly[] = {1, 0, -1, 0};

#define N 30005

ll x[N], y[N], n, l, u;

void solve() {
	ifstream fin("secv3.in");
	ofstream fout("secv3.out");
	fin >> n >> l >> u;
	for (ll i = 1; i <= n; ++i) {
		fin >> x[i];
		x[i] += x[i - 1];
	}
	for (ll i = 1; i <= n; ++i) {
		fin >> y[i];
		y[i] += y[i - 1];
	}
	double rez = 0;
	for (ll i = l; i <= n; ++i) {
		// cout << rez << endl;
		rez = max(rez, ((double)(x[i] - x[i-l]) / (double)(y[i] - y[i-l])));		
	}
	fout << rez;
}

int main() {
	ios_base::sync_with_stdio(false);
#ifndef Wi_TEST
	cin.tie(0);
#endif
	
	int t = 1;
	// cin >> t;
	for(int i = 1; i <= t; ++i) {
		solve();
	}
}