#include "bits/stdc++.h" using namespace std; int main() { int N; cin >> N; vector 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 ans = N; for (int i = 0; i < N; i++) { priority_queue> pq; for (int j = 0; j < N; j++) { pq.push(make_pair(-A[j], 0)); } for (int j = 0; j < N; j++) { int up = B[(i + j) % N] / 2; auto now = pq.top(); pq.pop(); pq.push(make_pair(now.first - up, now.second - 1)); } int temp = 0; while (!pq.empty()){ auto now = pq.top(); pq.pop(); temp = max(temp, -now.second); } ans = min(temp, ans); } cout << ans << endl; }