#define _USE_MATH_DEFINES #include <algorithm> #include <cstdio> #include <functional> #include <iostream> #include <cfloat> #include <climits> #include <cstring> #include <cmath> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <time.h> #include <vector> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> i_i; typedef pair<ll, int> ll_i; typedef pair<double, int> d_i; typedef pair<ll, ll> ll_ll; typedef pair<double, double> d_d; struct edge { int u, v; ll w; }; ll MOD = 1000000007; ll _MOD = 1000000009; double EPS = 1e-10; int f(int N, vector<int>& A, vector<int>& B) { priority_queue<i_i, vector<i_i>, greater<i_i>> pq; for (int i = 0; i < N; i++) pq.push(i_i(A[i], 0)); for (int i = 0; i < N; i++) { i_i p = pq.top(); pq.pop(); pq.push(i_i(p.first + B[i] / 2, p.second + 1)); } int maxi = 0; for (int i = 0; i < N; i++) { maxi = max(maxi, pq.top().second); pq.pop(); } return maxi; } int main() { int N; cin >> N; vector<int> A(N), B(N); for (int i = 0; i < N; i++) cin >> A[i]; for (int i = 0; i < N; i++) cin >> B[i]; int mini = INT_MAX; for (int i = 0; i < N; i++) { mini = min(mini, f(N, A, B)); B.push_back(B[0]); B.erase(B.begin()); } cout << mini << endl; }