#include"bits/stdc++.h" //#include using namespace std; #define print(x) cout<> n; rep(i, 0, n) { cin >> a[i] ; } rep(i, 0, n) { cin >> b[i]; } int ans = n; rep(i, 0, n) { priority_queue> pq; for (int j = 0; j < n; j++) { pq.push(make_pair(-a[j], 0)); } rep(j, 0, n) { 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(-now.second, temp); } ans = min(temp, ans); } print(ans); }